mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
feat(climc): server batch convert to kvm
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
This commit is contained in:
@@ -63,6 +63,7 @@ func init() {
|
||||
cmd.BatchPerform("reset", new(options.ServerResetOptions))
|
||||
cmd.BatchPerform("restart", new(options.ServerRestartOptions))
|
||||
cmd.BatchPerform("purge", new(options.ServerIdsOptions))
|
||||
cmd.BatchPerform("convert-to-kvm", new(options.ServerConvertToKvmOptions))
|
||||
cmd.PrintObjectYAML().Perform("migrate-forecast", new(options.ServerMigrateForecastOptions))
|
||||
cmd.Perform("migrate", new(options.ServerMigrateOptions))
|
||||
cmd.Perform("live-migrate", new(options.ServerLiveMigrateOptions))
|
||||
@@ -946,16 +947,4 @@ func init() {
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.ServerConvertToKvmOptions{}, "server-convert-to-kvm", "Convert esxi server to kvm", func(s *mcclient.ClientSession, opts *options.ServerConvertToKvmOptions) error {
|
||||
params := jsonutils.Marshal(opts)
|
||||
dict := params.(*jsonutils.JSONDict)
|
||||
dict.Set("target_hypervisor", jsonutils.NewString("kvm"))
|
||||
result, err := modules.Servers.PerformAction(s, opts.ID, "convert", dict)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -110,12 +110,13 @@ type ServerSSHLoginOptions struct {
|
||||
}
|
||||
|
||||
type ServerConvertToKvmOptions struct {
|
||||
ServerIdOptions
|
||||
ServerIdsOptions
|
||||
|
||||
PreferHost string `help:"Perfer host id or name" json:"prefer_host"`
|
||||
}
|
||||
|
||||
func (o *ServerConvertToKvmOptions) Params() (jsonutils.JSONObject, error) {
|
||||
return jsonutils.Marshal(o), nil
|
||||
return options.StructToParams(o)
|
||||
}
|
||||
|
||||
type ServerStartOptions struct {
|
||||
|
||||
Reference in New Issue
Block a user