diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-03-01 12:04:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-01 12:04:29 -0800 |
commit | 2747c20867127c930d705f5162dcd78b4faf9624 (patch) | |
tree | 9a52705cf30e667ff097079c501eeb8b11d3066e /libpod/oci.go | |
parent | c0bc88decc236a7898ba05d9815fb5df7c050f44 (diff) | |
parent | 43fe2bf064a4c7e7e24f35abd76acc5add6cc09a (diff) | |
download | podman-2747c20867127c930d705f5162dcd78b4faf9624.tar.gz podman-2747c20867127c930d705f5162dcd78b4faf9624.tar.bz2 podman-2747c20867127c930d705f5162dcd78b4faf9624.zip |
Merge pull request #2485 from adrianreber/oci-check
Verify that used OCI runtime supports checkpoint
Diffstat (limited to 'libpod/oci.go')
-rw-r--r-- | libpod/oci.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libpod/oci.go b/libpod/oci.go index 4bf76f619..2b3cc5db5 100644 --- a/libpod/oci.go +++ b/libpod/oci.go @@ -898,3 +898,16 @@ func (r *OCIRuntime) checkpointContainer(ctr *Container, options ContainerCheckp args = append(args, ctr.ID()) return utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, nil, r.path, args...) } + +func (r *OCIRuntime) featureCheckCheckpointing() bool { + // Check if the runtime implements checkpointing. Currently only + // runc's checkpoint/restore implementation is supported. + cmd := exec.Command(r.path, "checkpoint", "-h") + if err := cmd.Start(); err != nil { + return false + } + if err := cmd.Wait(); err == nil { + return true + } + return false +} |