path: root/glustolibs-gluster/glustolibs/gluster
diff options
authorsayaleeraut <>2020-02-17 17:34:22 +0530
committerBala Konda Reddy M <>2020-02-18 09:19:26 +0000
commit3fe9165451733890ddd4e6b913160c249ec6ecf2 (patch)
treef3904ce4d44a85a2f92a89f774f9d454d0cc9ffe /glustolibs-gluster/glustolibs/gluster
parent47bfa358b326c56854e4868084a000d17d0e6780 (diff)
[LibFix] Add code to check brick
Earlier the method get_volume_type() passed when ran on interpreter. But when the method was called in a TC, it failed at condition (Line: 2235) because : e.g. The value of brickdir_path is " brick2/testvol_replicated_brick2/" and it is trying to find the value in the list ['', '', ''] returned by get_all_bricks(), which will fail. Now, with fix, it will run successfully as it tries to check if for host, the brick /bricks/brick2/testvol_replicated_brick2 is present in the list brick_paths[] which consists of only the paths and not the IP addresses of the bricks present on that host. Change-Id: Ie595faba1e92c559293ddd04f46b85065b23dfc5 Signed-off-by: sayaleeraut <>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster')
1 files changed, 7 insertions, 4 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/ b/glustolibs-gluster/glustolibs/gluster/
index 435ddcf43..b530f80a1 100644
--- a/glustolibs-gluster/glustolibs/gluster/
+++ b/glustolibs-gluster/glustolibs/gluster/
@@ -2222,7 +2222,7 @@ def get_volume_type(brickdir_path):
brickdir_path(str): The complete brick path.
- (e.g.,
+ (e.g.,
volume type(str): The volume type in str.
@@ -2230,9 +2230,12 @@ def get_volume_type(brickdir_path):
# Adding import here to avoid cyclic imports
from glustolibs.gluster.brick_libs import get_all_bricks
- (host, _) = brickdir_path.split(':')
+ (host, brick_path_info) = brickdir_path.split(':')
+ path_info = brick_path_info[:-1]
for volume in get_volume_list(host):
- if brickdir_path in get_all_bricks(host, volume):
+ brick_paths = [brick.split(':')[1] for brick in get_all_bricks(host,
+ volume)]
+ if path_info in brick_paths:
ret = get_volume_info(host, volume)
if ret is None:
g.log.error("Failed to get volume type for %s", volume)
@@ -2247,5 +2250,5 @@ def get_volume_type(brickdir_path):
return ret[volume].get('typeStr')
-"Failed to find brick-path %s for vol %s",
+"Failed to find brick-path %s for volume %s",
brickdir_path, volume)