summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-12-23 13:16:10 +0100
committerGitHub <noreply@github.com>2021-12-23 13:16:10 +0100
commitfbdfd55e2d58484edd2e56b85f50086746e80314 (patch)
tree59209932c32836b968966cb2f72e66acbb8ce8a3 /pkg
parent1b9a5964dbb25f8c3cf2b530ffba52325cc81678 (diff)
parentd669dbfb9fbb4bae56ba90ce9b58352c793eff6e (diff)
downloadpodman-fbdfd55e2d58484edd2e56b85f50086746e80314.tar.gz
podman-fbdfd55e2d58484edd2e56b85f50086746e80314.tar.bz2
podman-fbdfd55e2d58484edd2e56b85f50086746e80314.zip
Merge pull request #12672 from adrianreber/2021-12-21-check-for-memtrack
Error out early if system does not support pre-copy checkpointing
Diffstat (limited to 'pkg')
-rw-r--r--pkg/criu/criu.go22
-rw-r--r--pkg/criu/criu_unsupported.go7
2 files changed, 29 insertions, 0 deletions
diff --git a/pkg/criu/criu.go b/pkg/criu/criu.go
index 2a6805979..967da0dca 100644
--- a/pkg/criu/criu.go
+++ b/pkg/criu/criu.go
@@ -1,7 +1,12 @@
+// +build linux
+
package criu
import (
"github.com/checkpoint-restore/go-criu/v5"
+ "github.com/checkpoint-restore/go-criu/v5/rpc"
+
+ "google.golang.org/protobuf/proto"
)
// MinCriuVersion for Podman at least CRIU 3.11 is required
@@ -21,3 +26,20 @@ func CheckForCriu(version int) bool {
}
return result
}
+
+func MemTrack() bool {
+ features, err := criu.MakeCriu().FeatureCheck(
+ &rpc.CriuFeatures{
+ MemTrack: proto.Bool(true),
+ },
+ )
+ if err != nil {
+ return false
+ }
+
+ if features == nil || features.MemTrack == nil {
+ return false
+ }
+
+ return *features.MemTrack
+}
diff --git a/pkg/criu/criu_unsupported.go b/pkg/criu/criu_unsupported.go
new file mode 100644
index 000000000..51cd0c1fd
--- /dev/null
+++ b/pkg/criu/criu_unsupported.go
@@ -0,0 +1,7 @@
+// +build !linux
+
+package criu
+
+func MemTrack() bool {
+ return false
+}