允许创建host时候不指定zone

This commit is contained in:
Qiu Jian
2018-10-25 23:07:58 +08:00
parent b7fbf148db
commit ec9ca59aa1
4 changed files with 9 additions and 2 deletions
+1 -2
View File
@@ -475,7 +475,6 @@ func init() {
})
type HostCreateOptions struct {
ZONE string `help:"Zone where the host is located"`
NAME string `help:"Name of baremetal"`
MAC string `help:"Default MAC address of baremetal"`
Rack string `help:"Rack number of baremetal"`
@@ -500,7 +499,7 @@ func init() {
if len(args.IpmiAddr) > 0 {
params.Add(jsonutils.NewString(args.IpmiAddr), "ipmi_ip_addr")
}
result, err := modules.Hosts.CreateInContext(s, params, &modules.Zones, args.ZONE)
result, err := modules.Hosts.Create(s, params)
if err != nil {
return err
}
+3
View File
@@ -12,6 +12,7 @@ func init() {
type ServerDiskListOptions struct {
options.BaseListOptions
Server string `help:"ID or Name of Server"`
Disk string `help:"ID or Name of Disk"`
}
R(&ServerDiskListOptions{}, "server-disk-list", "List server disk pairs", func(s *mcclient.ClientSession, args *ServerDiskListOptions) error {
var params *jsonutils.JSONDict
@@ -27,6 +28,8 @@ func init() {
var err error
if len(args.Server) > 0 {
result, err = modules.Serverdisks.ListDescendent(s, args.Server, params)
} else if len(args.Disk) > 0 {
result, err = modules.Serverdisks.ListDescendent2(s, args.Disk, params)
} else {
result, err = modules.Serverdisks.List(s, params)
}
+2
View File
@@ -38,6 +38,8 @@ func init() {
var err error
if len(args.Server) > 0 {
result, err = modules.Servernetworks.ListDescendent(s, args.Server, params)
} else if len(args.Network) > 0 {
result, err = modules.Servernetworks.ListDescendent2(s, args.Network, params)
} else {
result, err = modules.Servernetworks.List(s, params)
}
+3
View File
@@ -175,5 +175,8 @@ func (opts *BaseListOptions) Params() (*jsonutils.JSONDict, error) {
params.Set("admin", jsonutils.NewBool(true))
}
}
if opts.Details == nil {
params.Set("details", jsonutils.JSONFalse)
}
return params, nil
}