fix(region,climc): eips: rename arg name for requested eip addr

This commit is contained in:
Yousong Zhou
2020-12-16 17:35:04 +08:00
parent 7b5b8ccd69
commit 4a8eee0db3
4 changed files with 7 additions and 5 deletions
+3 -3
View File
@@ -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)
+2
View File
@@ -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"`
+1 -1
View File
@@ -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"`
+1 -1
View File
@@ -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)