Skip to content

Commit

Permalink
Merge pull request #9996 from giuseppe/disable-cgroupfs-rootless-on-c…
Browse files Browse the repository at this point in the history
…group-v2

cgroup: do not set cgroup parent when rootless and cgroupfs
  • Loading branch information
openshift-merge-robot authored Apr 12, 2021
2 parents a6fb11e + 2fad29c commit ddffc7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libpod/container_internal_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -2216,7 +2216,7 @@ func (c *Container) getOCICgroupPath() (string, error) {
}
cgroupManager := c.CgroupManager()
switch {
case (rootless.IsRootless() && !unified) || c.config.NoCgroups:
case (rootless.IsRootless() && (cgroupManager == config.CgroupfsCgroupsManager || !unified)) || c.config.NoCgroups:
return "", nil
case c.config.CgroupsMode == cgroupSplit:
if c.config.CgroupParent != "" {
Expand Down
5 changes: 5 additions & 0 deletions test/system/420-cgroups.bats
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ load helpers
run_podman container inspect --format '{{.HostConfig.CgroupManager}}' myc
is "$output" "$other" "podman preserved .HostConfig.CgroupManager"

if is_rootless && test $other = cgroupfs ; then
run_podman container inspect --format '{{.HostConfig.CgroupParent}}' myc
is "$output" "" "podman didn't set .HostConfig.CgroupParent for cgroupfs and rootless"
fi

# Restart the container, without --cgroup-manager option (ie use default)
# Prior to #7970, this would fail with an OCI runtime error
run_podman start myc
Expand Down

0 comments on commit ddffc7f

Please sign in to comment.