From cf39f5ed4482912405381c1a4347e82f5ac21d8f Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Thu, 16 Aug 2018 18:47:10 +0800 Subject: [PATCH] climc: server-deploy password --- cmd/climc/shell/servers.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/climc/shell/servers.go b/cmd/climc/shell/servers.go index e6bccf2e57..bad4870e80 100644 --- a/cmd/climc/shell/servers.go +++ b/cmd/climc/shell/servers.go @@ -139,6 +139,7 @@ func init() { Net []string `help:"Network descriptions" metavar:"NETWORK"` IsolatedDevice []string `help:"Isolated device model or ID" metavar:"ISOLATED_DEVICE"` Keypair string `help:"SSH Keypair"` + Password string `help:"Default user password"` Iso string `help:"ISO image ID" metavar:"IMAGE_ID"` Ncpu int64 `help:"#CPU cores of VM server, default 1" default:"1" metavar:""` Vga string `help:"VGA driver" choices:"std|vmware|cirrus|qxl"` @@ -192,6 +193,9 @@ func init() { if args.NoAccountInit { params.Add(jsonutils.JSONFalse, "reset_password") } + if args.Password != "" { + params.Add(jsonutils.NewString(args.Password), "password") + } if len(args.Vdi) > 0 { params.Add(jsonutils.NewString(args.Vdi), "vdi") } @@ -484,6 +488,7 @@ func init() { DeleteKeypair bool `help:"Remove ssh Keypairs"` Deploy []string `help:"Specify deploy files in virtual server file system"` ResetPassword bool `help:"Force reset password"` + Password string `help:"Default user password"` } R(&ServerDeployOptions{}, "server-deploy", "Deploy hostname and keypair to a stopped virtual server", func(s *mcclient.ClientSession, args *ServerDeployOptions) error { params := jsonutils.NewDict() @@ -501,6 +506,9 @@ func init() { if args.ResetPassword { params.Add(jsonutils.JSONTrue, "reset_password") } + if args.Password != "" { + params.Add(jsonutils.NewString(args.Password), "password") + } srv, e := modules.Servers.PerformAction(s, args.ID, "deploy", params) if e != nil { return e