summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster
diff options
context:
space:
mode:
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