mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
允许创建host时候不指定zone
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user