Automatic merge from release/2.3.0 -> release/2.4.0

* commit 'ea8bf9db85aac920c310374f4ed0d394d0b9181d':
  climc: kube cluster restart agents
This commit is contained in:
李泽玺
2018-11-19 19:42:47 +08:00
2 changed files with 31 additions and 0 deletions

View File

@@ -203,4 +203,17 @@ func initCluster() {
printObject(ret)
return nil
})
R(&o.ClusterRestartAgentsOptions{}, cmdN("restart-agent"), "Restart node agents in cluster", func(s *mcclient.ClientSession, args *o.ClusterRestartAgentsOptions) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := k8s.Clusters.PerformAction(s, args.ID, "restart-agent", params)
if err != nil {
return err
}
printObject(ret)
return nil
})
}

View File

@@ -194,3 +194,21 @@ func (o ClusterDeleteNodesOptions) Params() (*jsonutils.JSONDict, error) {
params.Add(nodesArray, "nodes")
return params, nil
}
type ClusterRestartAgentsOptions struct {
ClusterDeleteNodesOptions
All bool `help:"Restart all nodes agent"`
}
func (o ClusterRestartAgentsOptions) Params() (*jsonutils.JSONDict, error) {
params, err := o.ClusterDeleteNodesOptions.Params()
if err != nil {
return nil, err
}
all := jsonutils.JSONFalse
if o.All {
all = jsonutils.JSONTrue
}
params.Add(all, "all")
return params, nil
}