summaryrefslogtreecommitdiff
path: root/pkg/criu/criu.go
diff options
context:
space:
mode:
authorAdrian Reber <areber@redhat.com>2018-10-02 13:27:47 +0000
committerAdrian Reber <adrian@lisas.de>2018-10-23 12:52:03 +0200
commitf75065842f53b0f5ee56681eb85e3ce4bbea1a27 (patch)
treeb6eea42d2e2f3c8c1764201d2682dd436389cc18 /pkg/criu/criu.go
parent20b5714f350fa6c8a449b3192c48bdc050ce30a8 (diff)
downloadpodman-f75065842f53b0f5ee56681eb85e3ce4bbea1a27.tar.gz
podman-f75065842f53b0f5ee56681eb85e3ce4bbea1a27.tar.bz2
podman-f75065842f53b0f5ee56681eb85e3ce4bbea1a27.zip
Add helper function to read out CRIU version
This adds a simple CRIU version check using the vendored-in CRIU go bindings. Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'pkg/criu/criu.go')
-rw-r--r--pkg/criu/criu.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkg/criu/criu.go b/pkg/criu/criu.go
new file mode 100644
index 000000000..f4cce238a
--- /dev/null
+++ b/pkg/criu/criu.go
@@ -0,0 +1,19 @@
+package criu
+
+import (
+ "github.com/checkpoint-restore/go-criu"
+)
+
+// MinCriuVersion for Podman at least CRIU 3.11 is required
+const MinCriuVersion = 31100
+
+// CheckForCriu uses CRIU's go bindings to check if the CRIU
+// binary exists and if it at least the version Podman needs.
+func CheckForCriu() bool {
+ c := criu.MakeCriu()
+ result, err := c.IsCriuAtLeast(MinCriuVersion)
+ if err != nil {
+ return false
+ }
+ return result
+}