Add an python binding that reads /run/libcgroup/systemd and if the file
exists, sets the systemd_default_cgroup. Then on all the paths
constructed, has the systemd_default_cgroup appended to it. This is
used when cgroup sub-tree is constructed for systemd delegation.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit
67805afc3f02495ab32fdc640f062c48b6e6b8f0)
int cgroup_create_scope2(cgroup *cgroup, int ignore_ownership,
const cgroup_systemd_scope_opts * const opts)
+ void cgroup_set_default_systemd_cgroup()
# vim: set et ts=4 sw=4:
if ret is not 0:
raise RuntimeError("cgroup_create_scope2 failed: {}".format(ret))
+ @staticmethod
+ def cgroup_set_default_systemd_cgroup():
+ """Set systemd_default_cgroup
+
+ Arguments:
+ None
+
+ Description:
+ Reads /run/libcgroup/systemd and if the file exists, sets the
+ systemd_default_cgroup. Then on all the paths constructed, has
+ the systemd_default_cgroup appended to it. This is used when
+ cgroup sub-tree is constructed for systemd delegation.
+ """
+ Cgroup.cgroup_init()
+ cgroup.cgroup_set_default_systemd_cgroup()
+
+
def __dealloc__(self):
cgroup.cgroup_free(&self._cgp);