diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-05-05 21:58:35 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-05-06 08:33:28 +0200 |
commit | 27ac750c7d949fc5922c4a11bf3e8e4606dd2a04 (patch) | |
tree | fe8f1fcc13f76c89e812dd6991ad64556991a2a7 /libpod/runtime_ctr.go | |
parent | 9b9bd9e0e7b72c91d8e60103e8da7999cefbc63d (diff) | |
download | podman-27ac750c7d949fc5922c4a11bf3e8e4606dd2a04.tar.gz podman-27ac750c7d949fc5922c4a11bf3e8e4606dd2a04.tar.bz2 podman-27ac750c7d949fc5922c4a11bf3e8e4606dd2a04.zip |
cgroup: fix rootless --cgroup-parent with pods
extend to pods the existing check whether the cgroup is usable when
running as rootless with cgroupfs.
commit 17ce567c6827abdcd517699bc07e82ccf48f7619 introduced the
regression.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod/runtime_ctr.go')
-rw-r--r-- | libpod/runtime_ctr.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index 328f47c12..7d31e392f 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -295,7 +295,10 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Contai if podCgroup == "" { return nil, errors.Wrapf(define.ErrInternal, "pod %s cgroup is not set", pod.ID()) } - ctr.config.CgroupParent = podCgroup + canUseCgroup := !rootless.IsRootless() || isRootlessCgroupSet(podCgroup) + if canUseCgroup { + ctr.config.CgroupParent = podCgroup + } } else if !rootless.IsRootless() { ctr.config.CgroupParent = CgroupfsDefaultCgroupParent } |