diff options
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_api.go | 8 | ||||
-rw-r--r-- | libpod/container_internal_linux.go | 9 | ||||
-rw-r--r-- | libpod/runtime.go | 2 |
3 files changed, 12 insertions, 7 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index 93becb80d..41a131ea2 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -666,14 +666,10 @@ func (c *Container) Batch(batchFunc func(*Container) error) error { newCtr.valid = true newCtr.batched = true - - if err := batchFunc(newCtr); err != nil { - return err - } - + err := batchFunc(newCtr) newCtr.batched = false - return c.save() + return err } // Sync updates the current state of the container, checking whether its state 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()) } diff --git a/libpod/runtime.go b/libpod/runtime.go index f012d66c2..1b26f851f 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -508,7 +508,7 @@ func makeRuntime(runtime *Runtime) (err error) { // Set up a firewall backend backendType := "" - if os.Geteuid() != 0 { + if rootless.IsRootless() { backendType = "none" } fwBackend, err := firewall.GetBackend(backendType) |