summaryrefslogtreecommitdiff
path: root/libpod/container_internal_linux.go
diff options
context:
space:
mode:
authorAdrian Reber <areber@redhat.com>2018-10-02 13:38:28 +0000
committerAdrian Reber <adrian@lisas.de>2018-10-23 12:52:03 +0200
commit8f6fb79ba88c4f325eff95940dd050da1f69153b (patch)
tree2349444443073d268a9317dfa69cf28e0c75f691 /libpod/container_internal_linux.go
parentf75065842f53b0f5ee56681eb85e3ce4bbea1a27 (diff)
downloadpodman-8f6fb79ba88c4f325eff95940dd050da1f69153b.tar.gz
podman-8f6fb79ba88c4f325eff95940dd050da1f69153b.tar.bz2
podman-8f6fb79ba88c4f325eff95940dd050da1f69153b.zip
Use the CRIU version check in checkpoint/restore
The newly introduced CRIU version check is now used to make sure checkpointing and restoring is only used if the CRIU version is new enough. Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'libpod/container_internal_linux.go')
-rw-r--r--libpod/container_internal_linux.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 9920efd55..b25645e5c 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -18,6 +18,7 @@ import (
cnitypes "github.com/containernetworking/cni/pkg/types/current"
crioAnnotations "github.com/containers/libpod/pkg/annotations"
"github.com/containers/libpod/pkg/chrootuser"
+ "github.com/containers/libpod/pkg/criu"
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/storage/pkg/idtools"
spec "github.com/opencontainers/runtime-spec/specs-go"
@@ -368,6 +369,10 @@ func (c *Container) addNamespaceContainer(g *generate.Generator, ns LinuxNS, ctr
func (c *Container) checkpoint(ctx context.Context, keep bool) (err error) {
+ if !criu.CheckForCriu() {
+ return errors.Errorf("checkpointing a container requires at least CRIU %d", criu.MinCriuVersion)
+ }
+
if c.state.State != ContainerStateRunning {
return errors.Wrapf(ErrCtrStateInvalid, "%q is not running, cannot checkpoint", c.state.State)
}
@@ -407,6 +412,10 @@ func (c *Container) checkpoint(ctx context.Context, keep bool) (err error) {
func (c *Container) restore(ctx context.Context, keep bool) (err error) {
+ if !criu.CheckForCriu() {
+ return errors.Errorf("restoring a container requires at least CRIU %d", criu.MinCriuVersion)
+ }
+
if (c.state.State != ContainerStateConfigured) && (c.state.State != ContainerStateExited) {
return errors.Wrapf(ErrCtrStateInvalid, "container %s is running or paused, cannot restore", c.ID())
}