summaryrefslogtreecommitdiff
path: root/libpod/oci.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-10-04 12:34:49 -0700
committerGitHub <noreply@github.com>2018-10-04 12:34:49 -0700
commit06a959f74ab4f23d5a789d03de4b2b73a3d53dc6 (patch)
tree42e0437cd91aae4b53cd769401d7becd2309feb6 /libpod/oci.go
parent3c31e176c7dfce3c86a45ff4750f740a5f8f9321 (diff)
parentdc987af0b0146ec5fd2026ca8db403806c3425df (diff)
downloadpodman-06a959f74ab4f23d5a789d03de4b2b73a3d53dc6.tar.gz
podman-06a959f74ab4f23d5a789d03de4b2b73a3d53dc6.tar.bz2
podman-06a959f74ab4f23d5a789d03de4b2b73a3d53dc6.zip
Merge pull request #469 from adrianreber/master
Add support to checkpoint/restore containers
Diffstat (limited to 'libpod/oci.go')
-rw-r--r--libpod/oci.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/libpod/oci.go b/libpod/oci.go
index e5db06540..cf2b76ab0 100644
--- a/libpod/oci.go
+++ b/libpod/oci.go
@@ -227,7 +227,7 @@ func bindPorts(ports []ocicni.PortMapping) ([]*os.File, error) {
return files, nil
}
-func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string) (err error) {
+func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string, restoreContainer bool) (err error) {
var stderrBuf bytes.Buffer
runtimeDir, err := GetRootlessRuntimeDir()
@@ -289,6 +289,10 @@ func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string) (er
args = append(args, "--syslog")
}
+ if restoreContainer {
+ args = append(args, "--restore", ctr.CheckpointPath())
+ }
+
logrus.WithFields(logrus.Fields{
"args": args,
}).Debugf("running conmon: %s", r.conmonPath)
@@ -766,3 +770,15 @@ func (r *OCIRuntime) execStopContainer(ctr *Container, timeout uint) error {
return nil
}
+
+// checkpointContainer checkpoints the given container
+func (r *OCIRuntime) checkpointContainer(ctr *Container) error {
+ // imagePath is used by CRIU to store the actual checkpoint files
+ imagePath := ctr.CheckpointPath()
+ // workPath will be used to store dump.log and stats-dump
+ workPath := ctr.bundlePath()
+ logrus.Debugf("Writing checkpoint to %s", imagePath)
+ logrus.Debugf("Writing checkpoint logs to %s", workPath)
+ return utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, nil, r.path, "checkpoint",
+ "--image-path", imagePath, "--work-path", workPath, ctr.ID())
+}