From 9d05e74073b308931e23577e266bce072a02c829 Mon Sep 17 00:00:00 2001 From: sayaleeraut Date: Thu, 23 Jan 2020 14:57:24 +0530 Subject: [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 --- glustolibs-gluster/glustolibs/gluster/gluster_init.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'glustolibs-gluster/glustolibs') 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]) -- cgit