summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster/gluster_init.py
diff options
context:
space:
mode:
authorsayaleeraut <saraut@redhat.com>2020-01-23 14:57:24 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2020-01-24 09:49:37 +0000
commit9d05e74073b308931e23577e266bce072a02c829 (patch)
tree1f80f15f254801b52788504d42090d8b5f7a0989 /glustolibs-gluster/glustolibs/gluster/gluster_init.py
parentdd52553cbfd4f0128e7207cbfd399422b560995a (diff)
[Lib] Adding function to check the Gluster version
The function will return the gluster version in float for the host it is called on. It accepts the host IP as a parameter. Change-Id: Icf48cf41031f0fa06cf3864e9215c5a960bb7c64 Signed-off-by: sayaleeraut <saraut@redhat.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/gluster_init.py')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/gluster_init.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/gluster_init.py b/glustolibs-gluster/glustolibs/gluster/gluster_init.py
index 047046737..29059e6a1 100644
--- a/glustolibs-gluster/glustolibs/gluster/gluster_init.py
+++ b/glustolibs-gluster/glustolibs/gluster/gluster_init.py
@@ -251,3 +251,19 @@ def wait_for_glusterd_to_start(servers, glusterd_start_wait_timeout=80):
count += 1
g.log.error("glusterd is not running on %s", servers)
return False
+
+
+def get_gluster_version(host):
+ """Checks the gluster version on the nodes
+
+ Args:
+ host(str): IP of the host whose gluster version has to be checked.
+
+ Returns:
+ (float): The gluster version value.
+ """
+ command = 'gluster --version'
+ _, out, _ = g.run(host, command)
+ g.log.info("The Gluster verion of the cluster under test is %s",
+ out)
+ return float(out.split(' ')[1])