Skip to content

Commit

Permalink
fix: should get runtime name from container info
Browse files Browse the repository at this point in the history
when use `ctr t checkpoint`, runtime name should get from container
info, but not passed by flag, since task has already running with
specified runtime

Signed-off-by: Ace-Tang <aceapril@126.com>
  • Loading branch information
Ace-Tang committed Nov 23, 2018
1 parent 32aa0cd commit 461222d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions cmd/ctr/commands/tasks/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package tasks

import (
"fmt"
"runtime"

"github.com/containerd/containerd"
"github.com/containerd/containerd/cmd/ctr/commands"
Expand All @@ -37,11 +36,6 @@ var checkpointCommand = cli.Command{
Name: "exit",
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 {
id := context.Args().First()
Expand All @@ -61,9 +55,13 @@ var checkpointCommand = cli.Command{
if err != nil {
return err
}
info, err := container.Info(ctx)
if err != nil {
return err
}
var opts []containerd.CheckpointTaskOpts
if context.Bool("exit") {
opts = append(opts, withExit(context.String("runtime")))
opts = append(opts, withExit(info.Runtime.Name))
}
checkpoint, err := task.Checkpoint(ctx, opts...)
if err != nil {
Expand Down

0 comments on commit 461222d

Please sign in to comment.