summaryrefslogtreecommitdiff
path: root/libpod/util_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/util_linux.go')
-rw-r--r--libpod/util_linux.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/libpod/util_linux.go b/libpod/util_linux.go
index 77dcf86f6..78cbc75a7 100644
--- a/libpod/util_linux.go
+++ b/libpod/util_linux.go
@@ -8,6 +8,7 @@ import (
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/cgroups"
+ "github.com/containers/libpod/pkg/rootless"
"github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -33,9 +34,16 @@ func systemdSliceFromPath(parent, name string) (string, error) {
return cgroupPath, nil
}
+func getDefaultSystemdCgroup() string {
+ if rootless.IsRootless() {
+ return SystemdDefaultRootlessCgroupParent
+ }
+ return SystemdDefaultCgroupParent
+}
+
// makeSystemdCgroup creates a systemd CGroup at the given location.
func makeSystemdCgroup(path string) error {
- controller, err := cgroups.NewSystemd(SystemdDefaultCgroupParent)
+ controller, err := cgroups.NewSystemd(getDefaultSystemdCgroup())
if err != nil {
return err
}
@@ -45,7 +53,7 @@ func makeSystemdCgroup(path string) error {
// deleteSystemdCgroup deletes the systemd cgroup at the given location
func deleteSystemdCgroup(path string) error {
- controller, err := cgroups.NewSystemd(SystemdDefaultCgroupParent)
+ controller, err := cgroups.NewSystemd(getDefaultSystemdCgroup())
if err != nil {
return err
}