diff --git a/cmd/climc/shell/compute/elasticips.go b/cmd/climc/shell/compute/elasticips.go index f1a4eee54b..5989bb6d2a 100644 --- a/cmd/climc/shell/compute/elasticips.go +++ b/cmd/climc/shell/compute/elasticips.go @@ -50,7 +50,7 @@ func init() { Manager string `help:"cloud provider"` Region string `help:"cloud region in which EIP is allocated"` Bandwidth int `help:"Bandwidth in Mbps"` - Ip string `help:"IP address of the EIP"` + IpAddr string `help:"IP address of the EIP" json:"ip_addr"` Network string `help:"Network of the EIP"` BgpType string `help:"BgpType of the EIP" positional:"false"` ChargeType string `help:"bandwidth charge type" choices:"traffic|bandwidth"` @@ -79,8 +79,8 @@ func init() { params.Add(jsonutils.NewString(args.BgpType), "bgp_type") } - if len(args.Ip) > 0 { - params.Add(jsonutils.NewString(args.Ip), "ip") + if len(args.IpAddr) > 0 { + params.Add(jsonutils.NewString(args.IpAddr), "ip_addr") } result, err := modules.Elasticips.Create(s, params) diff --git a/pkg/apis/compute/elasticip.go b/pkg/apis/compute/elasticip.go index 3f82b79a2a..241ced2b12 100644 --- a/pkg/apis/compute/elasticip.go +++ b/pkg/apis/compute/elasticip.go @@ -67,6 +67,8 @@ type SElasticipCreateInput struct { // 子网Id // 私有云创建此参数必传,例如Openstack, ZStack NetworkId string `json:"network_id"` + // 指定新建EIP的地址 + IpAddr string `json:"ip_addr"` // description: BgpType for the new eip BgpType string `json:"bgp_type"` diff --git a/pkg/compute/models/elasticips.go b/pkg/compute/models/elasticips.go index bd2ef7a70c..254c3903dd 100644 --- a/pkg/compute/models/elasticips.go +++ b/pkg/compute/models/elasticips.go @@ -85,7 +85,7 @@ type SElasticip struct { Mode string `width:"32" charset:"ascii" get:"user" list:"user" create:"optional"` // IP地址 - IpAddr string `width:"17" charset:"ascii" list:"user" create:"optional"` + IpAddr string `width:"17" charset:"ascii" list:"user"` // 绑定资源类型 AssociateType string `width:"32" charset:"ascii" list:"user"` diff --git a/pkg/compute/tasks/eip_allocate_task.go b/pkg/compute/tasks/eip_allocate_task.go index f7c7d48427..a31a20679b 100644 --- a/pkg/compute/tasks/eip_allocate_task.go +++ b/pkg/compute/tasks/eip_allocate_task.go @@ -82,7 +82,7 @@ func (self *EipAllocateTask) OnInit(ctx context.Context, obj db.IStandaloneModel return } network := _network.(*models.SNetwork) - reqIp, _ := self.GetParams().GetString("ip") + reqIp, _ := self.GetParams().GetString("ip_addr") if reqIp != "" || !eipIsManaged { lockman.LockObject(ctx, network) defer lockman.ReleaseObject(ctx, network)