server: honor container stop timeout from CRI

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-05-15 15:27:03 +02:00
parent 20e9aeb16f
commit b3683ab184
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
6 changed files with 29 additions and 21 deletions

View file

@ -148,7 +148,7 @@ var stopContainerCommand = cli.Command{
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
err = StopContainer(client, context.String("id"))
err = StopContainer(client, context.String("id"), -1)
if err != nil {
return fmt.Errorf("Stopping the container failed: %v", err)
}
@ -402,12 +402,13 @@ func StartContainer(client pb.RuntimeServiceClient, ID string) error {
// StopContainer sends a StopContainerRequest to the server, and parses
// the returned StopContainerResponse.
func StopContainer(client pb.RuntimeServiceClient, ID string) error {
func StopContainer(client pb.RuntimeServiceClient, ID string, timeout int64) error {
if ID == "" {
return fmt.Errorf("ID cannot be empty")
}
_, err := client.StopContainer(context.Background(), &pb.StopContainerRequest{
ContainerId: ID,
Timeout: timeout,
})
if err != nil {
return err