diff options
author | kshithijiyer <kshithij.ki@gmail.com> | 2020-07-23 16:48:06 +0530 |
---|---|---|
committer | Bala Konda Reddy M <bala12352@gmail.com> | 2020-07-27 05:28:16 +0000 |
commit | 2c1c3111fd2eb39175a3f36122527ec154e85dd8 (patch) | |
tree | 0e0e988094951e3e724f15f26e89a449d64e8eab /glustolibs-gluster/glustolibs/gluster/layout.py | |
parent | 5727e6a8e11e894fce2bf7814a84077a4f95c5b0 (diff) |
[Libfix] Remove get_gluster_version() checks
Problem:
When run for nightly gluster builds dht cases fails
with below traceback:
```
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])
E ValueError: could not convert string to float: '20200719.9334a8d\nRepository
```
This is due to nightly builds returning the below output:
```
$ gluster --version
glusterfs 20200708.cdf01cc
Repository revision: git://git.gluster.org/glusterfs.git
Copyright (c) 2006-2016 Red Hat, Inc. <https://www.gluster.org/>
GlusterFS comes with ABSOLUTELY NO WARRANTY.
It is licensed to you under your choice of the GNU Lesser General Public License,
version 3 or any later version (LGPLv3 or later), or the GNU General Public License,
version 2 (GPLv2), in all cases as published by the Free Software Foundation.
```
Instead of:
```
$ gluster --version
glusterfs 6.0
```
This is caused as while building the we use
`VERSION="${GIT_DATE}.${GIT_HASH}` which causes the version
API to return new output.
Solution:
Remove the checks and modify the function
to return string instead of float.
Fixes: https://github.com/gluster/glusto-tests/issues/22
Change-Id: I2e889bd0354a1aa75de25aedf8b14eb5ff5ecbe6
Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/layout.py')
-rw-r--r-- | glustolibs-gluster/glustolibs/gluster/layout.py | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/layout.py b/glustolibs-gluster/glustolibs/gluster/layout.py index 8d7ae2d6f..ea5a5bc8b 100644 --- a/glustolibs-gluster/glustolibs/gluster/layout.py +++ b/glustolibs-gluster/glustolibs/gluster/layout.py @@ -19,7 +19,6 @@ from glusto.core import Glusto as g from glustolibs.gluster.brickdir import BrickDir -from glustolibs.gluster.gluster_init import get_gluster_version class Layout(object): @@ -35,20 +34,19 @@ class Layout(object): self._brickdirs = [] for brickdir_path in self._pathinfo['brickdir_paths']: (host, _) = brickdir_path.split(':') - if get_gluster_version(host) >= 6.0: - ret = get_volume_type(brickdir_path) - if ret in ('Replicate', 'Disperse', 'Arbiter'): - g.log.info("Cannot get layout as volume under test is" - " Replicate/Disperse/Arbiter and DHT" - " pass-through was enabled after Gluster 6.") + ret = get_volume_type(brickdir_path) + if ret in ('Replicate', 'Disperse', 'Arbiter'): + g.log.info("Cannot get layout as volume under test is" + " Replicate/Disperse/Arbiter and DHT" + " pass-through was enabled after Gluster 6.0") + else: + brickdir = BrickDir(brickdir_path) + if brickdir is None: + g.log.error("Failed to get the layout") else: - brickdir = BrickDir(brickdir_path) - if brickdir is None: - g.log.error("Failed to get the layout") - else: - g.log.debug("%s: %s" % (brickdir.path, - brickdir.hashrange)) - self._brickdirs.append(brickdir) + g.log.debug("%s: %s" % (brickdir.path, + brickdir.hashrange)) + self._brickdirs.append(brickdir) def __init__(self, pathinfo): """Init the layout class @@ -80,9 +78,8 @@ class Layout(object): for brickdir_path in self._pathinfo['brickdir_paths']: (host, _) = brickdir_path.split(':') - if (get_gluster_version(host) >= 6.0 and - get_volume_type(brickdir_path) in ('Replicate', 'Disperse', - 'Arbiter')): + if get_volume_type(brickdir_path) in ('Replicate', 'Disperse', + 'Arbiter'): g.log.info("Cannot check for layout completeness as volume" " under test is Replicate/Disperse/Arbiter and DHT" " pass-though was enabled after Gluster 6.") |