summaryrefslogtreecommitdiff
path: root/libpod/pod_internal.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-05-06 09:39:03 -0400
committerGitHub <noreply@github.com>2021-05-06 09:39:03 -0400
commit176ae99187de9068670dac1fb3ec30e11cd3dd93 (patch)
treeb1cb4cd71bf7ea541f3336ee2a79d83eacdb22c2 /libpod/pod_internal.go
parent5fa31e10e364e57f7bdc4bb00f483b7f6a631ee0 (diff)
parent27ac750c7d949fc5922c4a11bf3e8e4606dd2a04 (diff)
downloadpodman-176ae99187de9068670dac1fb3ec30e11cd3dd93.tar.gz
podman-176ae99187de9068670dac1fb3ec30e11cd3dd93.tar.bz2
podman-176ae99187de9068670dac1fb3ec30e11cd3dd93.zip
Merge pull request #10234 from giuseppe/fix-cgroupfs-pod
cgroup: fix rootless --cgroup-parent with pods
Diffstat (limited to 'libpod/pod_internal.go')
-rw-r--r--libpod/pod_internal.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/libpod/pod_internal.go b/libpod/pod_internal.go
index 31b4ba443..e81bd7b16 100644
--- a/libpod/pod_internal.go
+++ b/libpod/pod_internal.go
@@ -7,6 +7,7 @@ import (
"github.com/containers/common/pkg/config"
"github.com/containers/podman/v3/libpod/define"
+ "github.com/containers/podman/v3/pkg/rootless"
"github.com/containers/storage/pkg/stringid"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -74,9 +75,11 @@ func (p *Pod) refresh() error {
}
p.state.CgroupPath = cgroupPath
case config.CgroupfsCgroupsManager:
- p.state.CgroupPath = filepath.Join(p.config.CgroupParent, p.ID())
+ if rootless.IsRootless() && isRootlessCgroupSet(p.config.CgroupParent) {
+ p.state.CgroupPath = filepath.Join(p.config.CgroupParent, p.ID())
- logrus.Debugf("setting pod cgroup to %s", p.state.CgroupPath)
+ logrus.Debugf("setting pod cgroup to %s", p.state.CgroupPath)
+ }
default:
return errors.Wrapf(define.ErrInvalidArg, "unknown cgroups manager %s specified", p.runtime.config.Engine.CgroupManager)
}