增加:通过cloud provider来过滤虚拟机的功能

This commit is contained in:
Qiu Jian
2018-08-23 13:32:11 +08:00
parent 80c56e00fe
commit 0d6a9f33c6
2 changed files with 45 additions and 20 deletions
+4
View File
@@ -64,6 +64,7 @@ func init() {
Secgroup string `help:"Secgroup ID or Name"`
AdminSecgroup string `help:"AdminSecgroup ID or Name"`
Hypervisor string `help:"Show server of hypervisor" choices:"kvm|esxi|container|baremetal|aliyun"`
Manager string `help:"Show servers imported from manager"`
BaseListOptions
}
R(&ServerListOptions{}, "server-list", "List virtual servers", func(s *mcclient.ClientSession, args *ServerListOptions) error {
@@ -98,6 +99,9 @@ func init() {
if len(args.Hypervisor) > 0 {
params.Add(jsonutils.NewString(args.Hypervisor), "hypervisor")
}
if len(args.Manager) > 0 {
params.Add(jsonutils.NewString(args.Manager), "manager")
}
result, err := modules.Servers.List(s, params)
if err != nil {
return err