From: Prem Karat <[email protected]> This function will return the cgroup controller mount points from /proc/mounts file which will help in building the path for various cgroup stat files.
Changes from v3: * Fail on unknown controller before reading /proc/mounts * Fix typo on 'devices' controller Signed-off-by: Prem Karat <[email protected]> --- client/base_utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/client/base_utils.py b/client/base_utils.py index 3e435fa..3d53c00 100644 --- a/client/base_utils.py +++ b/client/base_utils.py @@ -722,6 +722,20 @@ def probe_cpus(): return utils.system_output(cmd).splitlines() +def get_cgroup_mountpoint(controller): + controller_list = [ 'cpuacct', 'cpu', 'memory', 'cpuset', + 'devices', 'freezer', 'blkio', 'netcls' ] + + if controller not in controller_list: + raise error.TestError("Doesn't support controller <%s>" % controller) + + f_cgcon = open("/proc/mounts", "rU") + cgconf_txt = f_cgcon.read() + f_cgcon.close() + mntpt = re.findall(r"\s(\S*cgroup/%s)" % controller, cgconf_txt) + return mntpt[0] + + def ping_default_gateway(): """Ping the default gateway.""" -- 1.7.11.4 _______________________________________________ Autotest-kernel mailing list [email protected] https://www.redhat.com/mailman/listinfo/autotest-kernel
