diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2018-10-23 07:53:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-23 07:53:11 -0700 |
commit | 2e6bc3c7af261228ae7a75cb5749062928fa24b3 (patch) | |
tree | 94b3af23e8f5d774be0e4846698fac685a5f56f3 /libpod | |
parent | 79befd5158c8f01a88e4d14e46851ddcc11d51c4 (diff) | |
parent | a14155917baa577bebbbc0c5983a7a90bf35c2b5 (diff) | |
download | podman-2e6bc3c7af261228ae7a75cb5749062928fa24b3.tar.gz podman-2e6bc3c7af261228ae7a75cb5749062928fa24b3.tar.bz2 podman-2e6bc3c7af261228ae7a75cb5749062928fa24b3.zip |
Merge pull request #1627 from adrianreber/criu
Add CRIU version check for checkpoint and restore
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal_linux.go | 9 |
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()) } |