We can't pause rootless containers during cp

Rootless containers can't be paused (no CGroups, so no freezer).

We could try and emulate this with a SIGSTOP to all PIDs in the
container, but that's inherently racy, so let's avoid it for now.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
Matthew Heon
2019-05-29 22:43:07 -04:00
parent f456825fe8
commit 48e35f7da7

View File

@ -13,6 +13,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/storage"
"github.com/containers/storage/pkg/archive"
"github.com/containers/storage/pkg/chrootarchive"
@ -95,7 +96,12 @@ func copyBetweenHostAndContainer(runtime *libpod.Runtime, src string, dest strin
}
defer ctr.Unmount(false)
if pause {
// We can't pause rootless containers.
if pause && rootless.IsRootless() {
logrus.Warnf("Cannot pause rootless containers - pause option will be ignored")
}
if pause && !rootless.IsRootless() {
if err := ctr.Pause(); err != nil {
// An invalid state error is fine.
// The container isn't running or is already paused.