mirror of
https://github.com/containers/podman.git
synced 2025-06-17 23:20:59 +08:00
cgroup: do not set cgroup parent when rootless and cgroupfs
do not set the cgroup parent when running as rootless with cgroupfs, even if cgroup v2 is used. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1947999 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -2216,7 +2216,7 @@ func (c *Container) getOCICgroupPath() (string, error) {
|
|||||||
}
|
}
|
||||||
cgroupManager := c.CgroupManager()
|
cgroupManager := c.CgroupManager()
|
||||||
switch {
|
switch {
|
||||||
case (rootless.IsRootless() && !unified) || c.config.NoCgroups:
|
case (rootless.IsRootless() && (cgroupManager == config.CgroupfsCgroupsManager || !unified)) || c.config.NoCgroups:
|
||||||
return "", nil
|
return "", nil
|
||||||
case c.config.CgroupsMode == cgroupSplit:
|
case c.config.CgroupsMode == cgroupSplit:
|
||||||
if c.config.CgroupParent != "" {
|
if c.config.CgroupParent != "" {
|
||||||
|
@ -24,6 +24,11 @@ load helpers
|
|||||||
run_podman container inspect --format '{{.HostConfig.CgroupManager}}' myc
|
run_podman container inspect --format '{{.HostConfig.CgroupManager}}' myc
|
||||||
is "$output" "$other" "podman preserved .HostConfig.CgroupManager"
|
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)
|
# Restart the container, without --cgroup-manager option (ie use default)
|
||||||
# Prior to #7970, this would fail with an OCI runtime error
|
# Prior to #7970, this would fail with an OCI runtime error
|
||||||
run_podman start myc
|
run_podman start myc
|
||||||
|
Reference in New Issue
Block a user