From aa827d814455999170295ae8214de34df65be290 Mon Sep 17 00:00:00 2001 From: TangBin Date: Thu, 21 Nov 2019 16:25:40 +0800 Subject: [PATCH] redis prepaid instance create bugfix --- pkg/multicloud/aliyun/elasticcache_instance.go | 2 +- pkg/multicloud/huawei/elasticcache_instance.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/multicloud/aliyun/elasticcache_instance.go b/pkg/multicloud/aliyun/elasticcache_instance.go index 6c52b5f8ee..c071b1aa25 100644 --- a/pkg/multicloud/aliyun/elasticcache_instance.go +++ b/pkg/multicloud/aliyun/elasticcache_instance.go @@ -626,7 +626,7 @@ func (self *SRegion) CreateIElasticcaches(ec *cloudprovider.SCloudElasticCacheIn params["VpcId"] = ec.VpcId params["VSwitchId"] = ec.NetworkId params["ChargeType"] = ec.ChargeType - if ec.ChargeType == billing.BILLING_TYPE_PREPAID && ec.BC != nil { + if strings.ToLower(ec.ChargeType) == billing.BILLING_TYPE_PREPAID && ec.BC != nil { if ec.BC.GetMonths() >= 1 && ec.BC.GetMonths() <= 9 { params["Period"] = strconv.Itoa(ec.BC.GetMonths()) } else if ec.BC.GetMonths() == 12 || ec.BC.GetMonths() == 24 || ec.BC.GetMonths() == 36 { diff --git a/pkg/multicloud/huawei/elasticcache_instance.go b/pkg/multicloud/huawei/elasticcache_instance.go index a0b7630611..a1e697c276 100644 --- a/pkg/multicloud/huawei/elasticcache_instance.go +++ b/pkg/multicloud/huawei/elasticcache_instance.go @@ -468,7 +468,7 @@ func (self *SRegion) CreateIElasticcaches(ec *cloudprovider.SCloudElasticCacheIn params.Set("maintain_end", jsonutils.NewString(ec.MaintainEnd)) } - if ec.ChargeType == billing_api.BILLING_TYPE_PREPAID && ec.BC != nil { + if strings.ToLower(ec.ChargeType) == billing_api.BILLING_TYPE_PREPAID && ec.BC != nil { bssParam := jsonutils.NewDict() bssParam.Set("charging_mode", jsonutils.NewString("prePaid")) bssParam.Set("is_auto_pay", jsonutils.NewString("true"))