From 9007c966cf69947f95343ea1b1c33d1d5ff32df3 Mon Sep 17 00:00:00 2001 From: TangBin Date: Thu, 24 Jan 2019 11:56:25 +0800 Subject: [PATCH] fix comment --- pkg/compute/tasks/eip_allocate_task.go | 2 +- pkg/util/huawei/securitygroup.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/compute/tasks/eip_allocate_task.go b/pkg/compute/tasks/eip_allocate_task.go index 22bcf0a43d..c3eaaaeb2d 100644 --- a/pkg/compute/tasks/eip_allocate_task.go +++ b/pkg/compute/tasks/eip_allocate_task.go @@ -45,7 +45,7 @@ func (self *EipAllocateTask) OnInit(ctx context.Context, obj db.IStandaloneModel return } - extEip, err := iregion.CreateEIP(eip.Name, eip.Bandwidth, eip.ChargeType, "") + extEip, err := iregion.CreateEIP(eip.Name, eip.Bandwidth, eip.ChargeType, eip.BgpType) if err != nil { msg := fmt.Sprintf("create eip fail %s", err) eip.SetStatus(self.UserCred, models.EIP_STATUS_ALLOCATE_FAIL, msg) diff --git a/pkg/util/huawei/securitygroup.go b/pkg/util/huawei/securitygroup.go index 5638e7df02..ce685575db 100644 --- a/pkg/util/huawei/securitygroup.go +++ b/pkg/util/huawei/securitygroup.go @@ -183,6 +183,10 @@ func (self *SSecurityGroup) GetSecurityRule(ruleId string, withRuleId bool) (sec _, ipNet, err = net.ParseCIDR("0.0.0.0/0") } + if err != nil { + return secrules.SecurityRule{}, err + } + // withRuleId.将ruleId附加到description字段。该hook有特殊目的,仅在同步安全组时使用。 desc := "" if withRuleId { @@ -202,6 +206,8 @@ func (self *SSecurityGroup) GetSecurityRule(ruleId string, withRuleId bool) (sec Ports: nil, Description: desc, } + + err = rule.ValidateRule() return rule, err }