networks: server_type: do not allow update

Transition between guest, baremetal, ipmi, eip, etc. all requires
sanity checks on relevant types allocated from the network
This commit is contained in:
Yousong Zhou
2021-03-01 19:05:44 +08:00
parent c0438d45f1
commit d54fdf6e71
3 changed files with 1 additions and 9 deletions
-4
View File
@@ -316,10 +316,6 @@ type NetworkUpdateInput struct {
VlanId *int `json:"vlan_id"`
// 服务器类型
// example: server
ServerType string `json:"server_type"`
// 分配策略
AllocPolicy string `json:"alloc_policy"`
+1 -1
View File
@@ -109,7 +109,7 @@ type SNetwork struct {
// 服务器类型
// example: server
ServerType string `width:"16" charset:"ascii" default:"guest" nullable:"true" list:"user" update:"user" create:"optional"`
ServerType string `width:"16" charset:"ascii" default:"guest" nullable:"true" list:"user" create:"optional"`
// 分配策略
AllocPolicy string `width:"16" charset:"ascii" nullable:"true" get:"user" update:"user" create:"optional"`
-4
View File
@@ -58,7 +58,6 @@ func (opts *NetworkListOptions) Params() (jsonutils.JSONObject, error) {
type NetworkUpdateOptions struct {
BaseUpdateOptions
ServerType string `help:"server type," choices:"baremetal|container|eip|guest|ipmi|pxe"`
StartIp string `help:"Start ip"`
EndIp string `help:"end ip"`
NetMask int64 `help:"Netmask"`
@@ -80,9 +79,6 @@ func (opts *NetworkUpdateOptions) Params() (jsonutils.JSONObject, error) {
if len(opts.Desc) > 0 {
params.Add(jsonutils.NewString(opts.Desc), "description")
}
if len(opts.ServerType) > 0 {
params.Add(jsonutils.NewString(opts.ServerType), "server_type")
}
if len(opts.StartIp) > 0 {
params.Add(jsonutils.NewString(opts.StartIp), "guest_ip_start")
}