]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tests: Add functional test cgroup class
authorTom Hromatka <tom.hromatka@oracle.com>
Fri, 21 Jun 2019 15:37:20 +0000 (09:37 -0600)
committerDhaval Giani <dhaval.giani@oracle.com>
Tue, 17 Sep 2019 22:14:02 +0000 (15:14 -0700)
commit8175ae65c5a746921180b5fcdb0a16b2317b773f
tree3fc01c2351de78726d164cfea9e52c927d39f860
parentb9cfa8dd92b6230e37f06acb815b5d9018c499c2
tests: Add functional test cgroup class

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>
tests/ftests/cgroup.py [new file with mode: 0644]
tests/ftests/consts.py