summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2019-07-17 16:59:46 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2019-07-23 07:25:44 +0000
commitb263b7b8ca7f1192c009e87e9e3c5efd814f69cd (patch)
treea29dafe9ec5f6d46e78a85e68d1d5c8efad6b5d6 /glustolibs-gluster
parent7dea784f135c10d4d6ecb1b5549e59e66e582b91 (diff)
Adding get_brick_processes_count() to brickmux_ops.
Adding get_brick_processes_count() which can be used to get the number of brick processes running on a given node would be needed for brickmux testcases to check if brickmux is honored or not. Change-Id: I6ec608b8f9d715d0f21e95fc3c0293eed287b16c Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
Diffstat (limited to 'glustolibs-gluster')
-rwxr-xr-xglustolibs-gluster/glustolibs/gluster/brickmux_ops.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/brickmux_ops.py b/glustolibs-gluster/glustolibs/gluster/brickmux_ops.py
index 2fff05806..887410759 100755
--- a/glustolibs-gluster/glustolibs/gluster/brickmux_ops.py
+++ b/glustolibs-gluster/glustolibs/gluster/brickmux_ops.py
@@ -137,3 +137,21 @@ def check_brick_pid_matches_glusterfsd_pid(mnode, volname):
_rc = False
return _rc
+
+
+def get_brick_processes_count(mnode):
+ """
+ Get the brick process count for a given node.
+
+ Args:
+ mnode (str): Node on which brick process has to be counted.
+
+ Returns:
+ int: Number of brick processes running on the node.
+ None: If the command fails to execute.
+ """
+ ret, out, _ = g.run(mnode, "pidof glusterfsd")
+ if not ret:
+ return len(out.split(" "))
+ else:
+ return None