Add pause/unpause implementation
This adds pause and unpause to containerd's execution service and the same commands to the `ctr` client. Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
This commit is contained in:
29
cmd/ctr/pause.go
Normal file
29
cmd/ctr/pause.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
gocontext "context"
|
||||
"errors"
|
||||
|
||||
"github.com/containerd/containerd/api/services/execution"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var pauseCommand = cli.Command{
|
||||
Name: "pause",
|
||||
Usage: "pause an existing container",
|
||||
ArgsUsage: "CONTAINER",
|
||||
Action: func(context *cli.Context) error {
|
||||
containers, err := getExecutionService(context)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
id := context.Args().First()
|
||||
if id == "" {
|
||||
return errors.New("container id must be provided")
|
||||
}
|
||||
_, err = containers.Pause(gocontext.Background(), &execution.PauseRequest{
|
||||
ID: id,
|
||||
})
|
||||
return err
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user