diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-08-14 11:21:26 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-08-14 15:46:07 +0200 |
commit | 9873901469bd5a4e435132cbb65aa6bacf798c2a (patch) | |
tree | 1280b3cef25bdeb04f5d54bea2a5e38695074e49 /libpod/util_linux.go | |
parent | a734b53357a84d5156e2902113e72d9384f9515b (diff) | |
download | podman-9873901469bd5a4e435132cbb65aa6bacf798c2a.tar.gz podman-9873901469bd5a4e435132cbb65aa6bacf798c2a.tar.bz2 podman-9873901469bd5a4e435132cbb65aa6bacf798c2a.zip |
pkg/cgroups: use DBUS session when rootless
use the DBUS user session when running in rootless mode.
Closes: https://github.com/containers/libpod/issues/3801
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod/util_linux.go')
-rw-r--r-- | libpod/util_linux.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libpod/util_linux.go b/libpod/util_linux.go index 78cbc75a7..d5c113daf 100644 --- a/libpod/util_linux.go +++ b/libpod/util_linux.go @@ -48,6 +48,9 @@ func makeSystemdCgroup(path string) error { return err } + if rootless.IsRootless() { + return controller.CreateSystemdUserUnit(path, rootless.GetRootlessUID()) + } return controller.CreateSystemdUnit(path) } @@ -57,6 +60,14 @@ func deleteSystemdCgroup(path string) error { if err != nil { return err } + if rootless.IsRootless() { + conn, err := cgroups.GetUserConnection(rootless.GetRootlessUID()) + if err != nil { + return err + } + defer conn.Close() + return controller.DeleteByPathConn(path, conn) + } return controller.DeleteByPath(path) } |