summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2019-05-14 10:23:21 +0530
committerAkarsha Rai <akrai@redhat.com>2019-05-23 07:00:25 +0000
commitcdac0c3f1972b4f42a0302b96515c2d646a498fa (patch)
treef512c7ed596f02538fd3672cc0662628782925b2
parent49d7e0ba2bdde0ef151f4654461906a2a7a97bc6 (diff)
Adding is_ganesha_installed & is_ganesha_running to nfs_ganesha_ops.py
Change-Id: Ib557ce211f1616ef261bf414a2c0b3864a5be24e Signed-off-by: Ambarish Soman <asoman@redhat.com> Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
-rw-r--r--glustolibs-gluster/glustolibs/gluster/nfs_ganesha_ops.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_ops.py b/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_ops.py
index 6722f07..476db2d 100644
--- a/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_ops.py
+++ b/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_ops.py
@@ -1192,3 +1192,36 @@ def set_acl(mnode, volname, acl=True, do_refresh_config=True):
if do_refresh_config:
return refresh_config(mnode, volname)
return True
+
+
+def is_ganesha_installed(mnode):
+ """Checks if Ganesha rpms are installed(prequisite for add node etc)
+
+ Args:
+ mnode (str): Node on which cmd has to be executed.
+
+ Returns:
+ True , if Ganesha rpms are installed. Else,False.
+ """
+
+ cmd = "rpm -q glusterfs-ganesha"
+ ret, _, _ = g.run(mnode, cmd)
+ if ret:
+ return False
+ return True
+
+
+def is_ganesha_running(mnode):
+ """Checks if Ganesha service is running (for validation post tests)
+
+ Args:
+ mnode (str): Node on which cmd has to be executed.
+
+ Returns:
+ True , if Ganesha service is running. False, otherwise.
+ """
+ cmd = "pgrep nfs-ganesha"
+ _, out, _ = g.run(mnode, cmd)
+ if out:
+ return True
+ return False