The set of functions implemented here will return the cgroup controller
mount points from /etc/cgconfig.conf file which will help in building
the path for various cgroup stat files

Signed-off-by: Prem Karat <[email protected]>
---
 client/base_utils.py |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/client/base_utils.py b/client/base_utils.py
index 0a69488..a3318d4 100644
--- a/client/base_utils.py
+++ b/client/base_utils.py
@@ -722,6 +722,21 @@ def probe_cpus():
     return utils.system_output(cmd).splitlines()
 
 
+def get_cgroup_mntpt(controller):
+    controller_list = [ 'cpuacct', 'cpu', 'memory', 'cpuset', \
+                        'devies', 'freezer', 'blkio', 'netcls' ]
+    f_cgcon = open("/proc/mounts", "rU")
+    cgconf_txt = f_cgcon.read()
+    f_cgcon.close()
+
+    if controller not in controller_list:
+        raise error.TestError("Doesn't support controller <%s>" %
+controller)
+    else:
+        mntpt = re.findall(r"\s(\S*cgroup/%s)" %controller, cgconf_txt)
+        return mntpt[0]
+
+
 def ping_default_gateway():
     """Ping the default gateway."""
 
-- 
1.7.10.4

-- 
        -prem

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to