This commit adds a Cgroup() class for managing cgroups. This
class provides static methods for interacting with libcgroup's
interfaces including cgset, cgget, cgcreate, etc.
Example usages:
# create a cgroup in the cpuset controller named foo
Cgroup.create(config, 'cpuset', 'foo')
# set cpu.shares for foobar to 500
Cgroup.set(config, 'foobar', 'cpu.shares', '500')
# get the limit_in_bytes for AnotherCgroup. Have libcgroup
# strip off all of the decorations so that only the value is
# returned
limit_in_bytes = Cgroup.get(config, controller=None,
cgname='AnotherCgroup', setting='memory.limit_in_bytes',
print_headers=False, values_only=True)
Providing invalid parameters to a Cgroup method will result in
a ValueError while a failure to execute a command will result
in a RunError.
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com> Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>