ctr: shim state for secondary tasks
The v2 shim interface supports grouping, so a single shim can manage multiple tasks. Prior to this change, the `shim state` command could only query the state of the primary task (task that shares the same ID as the shim). Signed-off-by: Samuel Karp <samuelkarp@google.com>
This commit is contained in:
parent
58cf6e2830
commit
d59e8a8404
@ -67,7 +67,7 @@ var Command = &cli.Command{
|
|||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "id",
|
Name: "id",
|
||||||
Usage: "Container id",
|
Usage: "shim ID",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []*cli.Command{
|
||||||
@ -115,14 +115,26 @@ var deleteCommand = &cli.Command{
|
|||||||
|
|
||||||
var stateCommand = &cli.Command{
|
var stateCommand = &cli.Command{
|
||||||
Name: "state",
|
Name: "state",
|
||||||
Usage: "Get the state of all the processes of the task",
|
Usage: "Get the state of all main process of the task",
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "task-id",
|
||||||
|
Aliases: []string{"t"},
|
||||||
|
Usage: "task ID",
|
||||||
|
},
|
||||||
|
},
|
||||||
Action: func(cliContext *cli.Context) error {
|
Action: func(cliContext *cli.Context) error {
|
||||||
service, err := getTaskService(cliContext)
|
service, err := getTaskService(cliContext)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
id := cliContext.String("task-id")
|
||||||
|
if id == "" {
|
||||||
|
id = cliContext.String("id")
|
||||||
|
}
|
||||||
|
|
||||||
r, err := service.State(context.Background(), &task.StateRequest{
|
r, err := service.State(context.Background(), &task.StateRequest{
|
||||||
ID: cliContext.String("id"),
|
ID: id,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user