Merge pull request #2825 from Ace-Tang/ctr_fix_runtime
fix: should get runtime name from container info
This commit is contained in:
commit
75c490c5c4
@ -18,7 +18,6 @@ package tasks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
|
||||||
|
|
||||||
"github.com/containerd/containerd"
|
"github.com/containerd/containerd"
|
||||||
"github.com/containerd/containerd/cmd/ctr/commands"
|
"github.com/containerd/containerd/cmd/ctr/commands"
|
||||||
@ -37,11 +36,6 @@ var checkpointCommand = cli.Command{
|
|||||||
Name: "exit",
|
Name: "exit",
|
||||||
Usage: "stop the container after the checkpoint",
|
Usage: "stop the container after the checkpoint",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
|
||||||
Name: "runtime",
|
|
||||||
Usage: "runtime name",
|
|
||||||
Value: fmt.Sprintf("io.containerd.runtime.v1.%s", runtime.GOOS),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Action: func(context *cli.Context) error {
|
Action: func(context *cli.Context) error {
|
||||||
id := context.Args().First()
|
id := context.Args().First()
|
||||||
@ -61,9 +55,13 @@ var checkpointCommand = cli.Command{
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
info, err := container.Info(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
var opts []containerd.CheckpointTaskOpts
|
var opts []containerd.CheckpointTaskOpts
|
||||||
if context.Bool("exit") {
|
if context.Bool("exit") {
|
||||||
opts = append(opts, withExit(context.String("runtime")))
|
opts = append(opts, withExit(info.Runtime.Name))
|
||||||
}
|
}
|
||||||
checkpoint, err := task.Checkpoint(ctx, opts...)
|
checkpoint, err := task.Checkpoint(ctx, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user