crioctl ctr stop: enable timeout input
Signed-off-by: CuiHaozhi <cuihz@wise2c.com>
This commit is contained in:
parent
3b295967f1
commit
13fd708f04
1 changed files with 6 additions and 1 deletions
|
@ -138,6 +138,11 @@ var stopContainerCommand = cli.Command{
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "id of the container",
|
Usage: "id of the container",
|
||||||
},
|
},
|
||||||
|
cli.Int64Flag{
|
||||||
|
Name: "timeout",
|
||||||
|
Value: 10,
|
||||||
|
Usage: "seconds to wait to kill the container after a graceful stop is requested",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: func(context *cli.Context) error {
|
Action: func(context *cli.Context) error {
|
||||||
// Set up a connection to the server.
|
// Set up a connection to the server.
|
||||||
|
@ -148,7 +153,7 @@ var stopContainerCommand = cli.Command{
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
client := pb.NewRuntimeServiceClient(conn)
|
client := pb.NewRuntimeServiceClient(conn)
|
||||||
|
|
||||||
err = StopContainer(client, context.String("id"), -1)
|
err = StopContainer(client, context.String("id"), context.Int64("timeout"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Stopping the container failed: %v", err)
|
return fmt.Errorf("Stopping the container failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue