diff options
author | Andrei Vagin <avagin@gmail.com> | 2019-05-03 21:40:48 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-05-03 21:41:45 -0700 |
commit | bf0ac565d2873069799082ad7bc3e3c43acbc593 (patch) | |
tree | 398abb381e328568809e6e6b46a3a3a2d4034e25 /runsc/cmd/restore.go | |
parent | b4a9f186872d6687f34e609a39aa10eb33cce1d2 (diff) |
Fix runsc restore to be compatible with docker start --checkpoint ...
Change-Id: I02b30de13f1393df66edf8829fedbf32405d18f8
PiperOrigin-RevId: 246621192
Diffstat (limited to 'runsc/cmd/restore.go')
-rw-r--r-- | runsc/cmd/restore.go | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/runsc/cmd/restore.go b/runsc/cmd/restore.go index 27b06713a..3ab2f5676 100644 --- a/runsc/cmd/restore.go +++ b/runsc/cmd/restore.go @@ -33,6 +33,9 @@ type Restore struct { // imagePath is the path to the saved container image imagePath string + + // detach indicates that runsc has to start a process and exit without waiting it. + detach bool } // Name implements subcommands.Command.Name. @@ -55,10 +58,9 @@ func (*Restore) Usage() string { func (r *Restore) SetFlags(f *flag.FlagSet) { r.Create.SetFlags(f) f.StringVar(&r.imagePath, "image-path", "", "directory path to saved container image") + f.BoolVar(&r.detach, "detach", false, "detach from the container's process") // Unimplemented flags necessary for compatibility with docker. - var d bool - f.BoolVar(&d, "detach", false, "ignored") var nsr bool f.BoolVar(&nsr, "no-subreaper", false, "ignored") @@ -92,17 +94,9 @@ func (r *Restore) Execute(_ context.Context, f *flag.FlagSet, args ...interface{ Fatalf("image-path flag must be provided") } - restoreFile := filepath.Join(r.imagePath, checkpointFileName) - - c, err := container.Load(conf.RootDir, id) - if err != nil { - Fatalf("loading container: %v", err) - } - if err := c.Restore(spec, conf, restoreFile); err != nil { - Fatalf("restoring container: %v", err) - } + conf.RestoreFile = filepath.Join(r.imagePath, checkpointFileName) - ws, err := c.Wait() + ws, err := container.Run(id, spec, conf, bundleDir, r.consoleSocket, r.pidFile, r.userLog, r.detach) if err != nil { Fatalf("running container: %v", err) } |