summaryrefslogtreecommitdiff
path: root/pkg/checkpoint/crutils/checkpoint_restore_utils.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-07-28 14:48:28 +0200
committerGitHub <noreply@github.com>2021-07-28 14:48:28 +0200
commit6c5966cf3cbfa15602ba2d9ef57284f2669a321d (patch)
tree452db7496ba00a2e0da6ff4fce77b27a93fa7c12 /pkg/checkpoint/crutils/checkpoint_restore_utils.go
parenta5de8314188d7376f645d8ac6c6f7a6f685b6a45 (diff)
parent60b9e8c0da683d253f3828f00442fc5a75540368 (diff)
downloadpodman-6c5966cf3cbfa15602ba2d9ef57284f2669a321d.tar.gz
podman-6c5966cf3cbfa15602ba2d9ef57284f2669a321d.tar.bz2
podman-6c5966cf3cbfa15602ba2d9ef57284f2669a321d.zip
Merge pull request #10910 from adrianreber/2021-07-12-checkpoint-restore-into-pod
Add support for checkpoint/restore into and out of pods
Diffstat (limited to 'pkg/checkpoint/crutils/checkpoint_restore_utils.go')
-rw-r--r--pkg/checkpoint/crutils/checkpoint_restore_utils.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/checkpoint/crutils/checkpoint_restore_utils.go b/pkg/checkpoint/crutils/checkpoint_restore_utils.go
index 53ff55865..3b77368bb 100644
--- a/pkg/checkpoint/crutils/checkpoint_restore_utils.go
+++ b/pkg/checkpoint/crutils/checkpoint_restore_utils.go
@@ -1,6 +1,7 @@
package crutils
import (
+ "bytes"
"io"
"os"
"os/exec"
@@ -189,3 +190,13 @@ func CRRuntimeSupportsCheckpointRestore(runtimePath string) bool {
}
return false
}
+
+// CRRuntimeSupportsCheckpointRestore tests if the runtime at 'runtimePath'
+// supports restoring into existing Pods. The runtime needs to support
+// the CRIU option --lsm-mount-context and the existence of this is checked
+// by this function. In addition it is necessary to at least have CRIU 3.16.
+func CRRuntimeSupportsPodCheckpointRestore(runtimePath string) bool {
+ cmd := exec.Command(runtimePath, "restore", "--lsm-mount-context")
+ out, _ := cmd.CombinedOutput()
+ return bytes.Contains(out, []byte("flag needs an argument"))
+}