From ff011aadc9bcc1907037d662d5606ddc617cee99 Mon Sep 17 00:00:00 2001 From: Tom Hromatka Date: Wed, 24 Mar 2021 18:56:23 +0000 Subject: [PATCH] cgroup.py: Add support for lssubsys Add support for lssubsys to the Cgroup class. Signed-off-by: Tom Hromatka --- ftests/cgroup.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/ftests/cgroup.py b/ftests/cgroup.py index 50a8856f..a3f394e2 100644 --- a/ftests/cgroup.py +++ b/ftests/cgroup.py @@ -655,3 +655,38 @@ class Cgroup(object): return config.container.run(cmd) else: return Run.run(cmd) + + @staticmethod + def lssubsys(config, ls_all=False, cghelp=False, hierarchies=False, + mount_points=False, all_mount_points=False): + cmd = list() + + cmd.append(Cgroup.build_cmd_path('lssubsys')) + + if ls_all: + cmd.append('-a') + + if cghelp: + cmd.append('-h') + + if hierarchies: + cmd.append('-i') + + if mount_points: + cmd.append('-m') + + if all_mount_points: + cmd.append('-M') + + if config.args.container: + ret = config.container.run(cmd) + else: + try: + ret = Run.run(cmd) + except RunError as re: + if "profiling" in re.stderr: + ret = re.stdout + else: + raise re + + return ret -- 2.47.2