summaryrefslogtreecommitdiffhomepage
path: root/runsc/cmd
diff options
context:
space:
mode:
authorJustine Olshan <justineolshan@google.com>2018-06-18 15:19:36 -0700
committerShentubot <shentubot@google.com>2018-06-18 15:20:36 -0700
commit873ec0c414973e829c1570f21d0d2e2a0df681f4 (patch)
tree708588baae26198231b64a5ff994fda6fb443040 /runsc/cmd
parent7eaca1074bf1a6c0e260727b2d9cbd3c878d2b77 (diff)
Modified boot.go to allow for restores.
A file descriptor was added as a flag to boot so a state file can restore a container that was checkpointed. PiperOrigin-RevId: 201068699 Change-Id: I18e96069488ffa3add468861397f3877725544aa
Diffstat (limited to 'runsc/cmd')
-rw-r--r--runsc/cmd/boot.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/runsc/cmd/boot.go b/runsc/cmd/boot.go
index 34dd8b3c0..86f597c09 100644
--- a/runsc/cmd/boot.go
+++ b/runsc/cmd/boot.go
@@ -48,6 +48,9 @@ type Boot struct {
// applyCaps determines if capabilities defined in the spec should be applied
// to the process.
applyCaps bool
+
+ // restoreFD is the file descriptor to the state file to be restored.
+ restoreFD int
}
// Name implements subcommands.Command.Name.
@@ -72,6 +75,7 @@ func (b *Boot) SetFlags(f *flag.FlagSet) {
f.Var(&b.ioFDs, "io-fds", "list of FDs to connect 9P clients. They must follow this order: root first, then mounts as defined in the spec")
f.BoolVar(&b.console, "console", false, "set to true if the sandbox should allow terminal ioctl(2) syscalls")
f.BoolVar(&b.applyCaps, "apply-caps", false, "if true, apply capabilities defined in the spec to the process")
+ f.IntVar(&b.restoreFD, "restore-fd", -1, "FD of the state file to be restored")
}
// Execute implements subcommands.Command.Execute. It starts a sandbox in a
@@ -127,7 +131,7 @@ func (b *Boot) Execute(_ context.Context, f *flag.FlagSet, args ...interface{})
}
// Create the loader.
- l, err := boot.New(spec, conf, b.controllerFD, b.ioFDs.GetArray(), b.console)
+ l, err := boot.New(spec, conf, b.controllerFD, b.restoreFD, b.ioFDs.GetArray(), b.console)
if err != nil {
Fatalf("error creating loader: %v", err)
}