Add a convenience method to clear the default slice/scope. This may be
useful in cases where the user is done with the slice/scope and wants to
resume operating at the root cgroup level.
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
if set_default:
Cgroup.__set_default_systemd_cgroup()
+ @staticmethod
+ def clear_default_systemd_scope():
+ """Clear/Remove the default slice/scope from libcgroup
+
+ Description:
+ Delete the default slice/scope from the libcgroup var/run file.
+ Also delete the internal global variable within libcgroup so that
+ the default path is restored back to the root cgroup
+ """
+ try:
+ Cgroup.write_default_systemd_scope('', '', set_default=False)
+ except RuntimeError:
+ pass
+
+ try:
+ Cgroup.__set_default_systemd_cgroup()
+ except RuntimeError:
+ pass
+
cdef compare(self, Cgroup other):
"""Compare this cgroup instance with another cgroup instance