From b263b7b8ca7f1192c009e87e9e3c5efd814f69cd Mon Sep 17 00:00:00 2001 From: kshithijiyer Date: Wed, 17 Jul 2019 16:59:46 +0530 Subject: 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 --- glustolibs-gluster/glustolibs/gluster/brickmux_ops.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'glustolibs-gluster/glustolibs/gluster/brickmux_ops.py') 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 -- cgit