diff --git a/cmd/climc/shell/compute/server_pod.go b/cmd/climc/shell/compute/server_pod.go index fd66ccec41..02ea45c9a4 100644 --- a/cmd/climc/shell/compute/server_pod.go +++ b/cmd/climc/shell/compute/server_pod.go @@ -43,9 +43,13 @@ func init() { }) R(&options.PodExecOptions{}, "pod-exec", "Execute a command in a container", func(s *mcclient.ClientSession, opt *options.PodExecOptions) error { - ctrs, err := modules.Containers.List(s, jsonutils.Marshal(map[string]string{ + listOpt := map[string]string{ "guest_id": opt.ID, - })) + } + if len(opt.Scope) != 0 { + listOpt["scope"] = opt.Scope + } + ctrs, err := modules.Containers.List(s, jsonutils.Marshal(listOpt)) if err != nil { return errors.Wrapf(err, "list containers by guest_id %s", opt.ID) } diff --git a/pkg/mcclient/options/compute/server_pod.go b/pkg/mcclient/options/compute/server_pod.go index 3c45447d85..bb55ca57a7 100644 --- a/pkg/mcclient/options/compute/server_pod.go +++ b/pkg/mcclient/options/compute/server_pod.go @@ -239,5 +239,6 @@ func (o *PodCreateOptions) Params() (*computeapi.ServerCreateInput, error) { type PodExecOptions struct { ContainerExecOptions + Scope string `help:"Scope of containers query" choices:"system|domain|project"` Container string `help:"Container name. If omitted, use the first container." short-token:"c"` }