summaryrefslogtreecommitdiff
path: root/libpod/container_internal_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-01-13 20:25:09 +0100
committerGitHub <noreply@github.com>2022-01-13 20:25:09 +0100
commit2c510146aa03c74fb00a15bcf81c62b14df9c7ea (patch)
tree3eed55c2709e17449ea5acde9cbb0a09152dd446 /libpod/container_internal_linux.go
parent48e63975aac7f13048a4b2e426e36d2c81828d6d (diff)
parent8dc2464b03a1c4183e0a6264cbe3f99b2f65687f (diff)
downloadpodman-2c510146aa03c74fb00a15bcf81c62b14df9c7ea.tar.gz
podman-2c510146aa03c74fb00a15bcf81c62b14df9c7ea.tar.bz2
podman-2c510146aa03c74fb00a15bcf81c62b14df9c7ea.zip
Merge pull request #12828 from giuseppe/drop-check
libpod: drop check for empty pod cgroup
Diffstat (limited to 'libpod/container_internal_linux.go')
-rw-r--r--libpod/container_internal_linux.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 5654f3c4f..28cc2c621 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -2728,6 +2728,24 @@ func isRootlessCgroupSet(cgroup string) bool {
return cgroup != CgroupfsDefaultCgroupParent && filepath.Dir(cgroup) != CgroupfsDefaultCgroupParent
}
+func (c *Container) expectPodCgroup() (bool, error) {
+ unified, err := cgroups.IsCgroup2UnifiedMode()
+ if err != nil {
+ return false, err
+ }
+ cgroupManager := c.CgroupManager()
+ switch {
+ case c.config.NoCgroups:
+ return false, nil
+ case cgroupManager == config.SystemdCgroupsManager:
+ return !rootless.IsRootless() || unified, nil
+ case cgroupManager == config.CgroupfsCgroupsManager:
+ return !rootless.IsRootless(), nil
+ default:
+ return false, errors.Wrapf(define.ErrInvalidArg, "invalid cgroup mode %s requested for pods", cgroupManager)
+ }
+}
+
// Get cgroup path in a format suitable for the OCI spec
func (c *Container) getOCICgroupPath() (string, error) {
unified, err := cgroups.IsCgroup2UnifiedMode()