summaryrefslogtreecommitdiff
path: root/libpod/pod_api.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-09-13 18:44:45 +0200
committerGitHub <noreply@github.com>2019-09-13 18:44:45 +0200
commite8a44ebd460a2cc2d499b02cb4e0f699a9965b85 (patch)
treef0ee4571f9a471bade27557a52def7100a4a9284 /libpod/pod_api.go
parent7875e00c663a42dd26c99889206cdb8f16ff0905 (diff)
parent88ebc33840ff07701254e2f6e2484f229f09a6cc (diff)
downloadpodman-e8a44ebd460a2cc2d499b02cb4e0f699a9965b85.tar.gz
podman-e8a44ebd460a2cc2d499b02cb4e0f699a9965b85.tar.bz2
podman-e8a44ebd460a2cc2d499b02cb4e0f699a9965b85.zip
Merge pull request #4006 from rhatdan/rootless
Report errors when trying to pause rootless containers
Diffstat (limited to 'libpod/pod_api.go')
-rw-r--r--libpod/pod_api.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/libpod/pod_api.go b/libpod/pod_api.go
index e2448e92a..7c786b835 100644
--- a/libpod/pod_api.go
+++ b/libpod/pod_api.go
@@ -5,6 +5,8 @@ import (
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/libpod/events"
+ "github.com/containers/libpod/pkg/cgroups"
+ "github.com/containers/libpod/pkg/rootless"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -163,6 +165,16 @@ func (p *Pod) Pause() (map[string]error, error) {
return nil, define.ErrPodRemoved
}
+ if rootless.IsRootless() {
+ cgroupv2, err := cgroups.IsCgroup2UnifiedMode()
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to determine cgroupversion")
+ }
+ if !cgroupv2 {
+ return nil, errors.Wrap(define.ErrNoCgroups, "can not pause pods containing rootless containers with cgroup V1")
+ }
+ }
+
allCtrs, err := p.runtime.state.PodContainers(p)
if err != nil {
return nil, err