summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2019-04-04 16:44:53 +0530
committerkshithijiyer <kshithij.ki@gmail.com>2019-04-04 16:44:53 +0530
commita3d2538da2470e82e0c389ddaf33d1d132172c50 (patch)
treee76b53f873f929258cf4981d018463aa791192e7
parentf2d4e893e8bbb8a399de8405cd6e311a52787aa1 (diff)
Modifying get_online_bricks_list() to give brick list with node down
get_online_bricks_list() used to fail in case of node down secnarios with KeyError exception adding code to catch the exception and provide brick list with bricks from gluster v status. Signed-off-by: kshithijiyer <kshithij.ki@gmail.com> Change-Id: Ia26208a52e4197050421bc34b9b8cdaf74ac4da6
-rw-r--r--glustolibs-gluster/glustolibs/gluster/brick_libs.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/brick_libs.py b/glustolibs-gluster/glustolibs/gluster/brick_libs.py
index 270b378..f840859 100644
--- a/glustolibs-gluster/glustolibs/gluster/brick_libs.py
+++ b/glustolibs-gluster/glustolibs/gluster/brick_libs.py
@@ -458,7 +458,11 @@ def get_online_bricks_list(mnode, volname):
bricks_list = get_all_bricks(mnode, volname)
for brick in bricks_list:
brick_node, brick_path = brick.split(":")
- status = int(volume_status[volname][brick_node][brick_path]['status'])
+ try:
+ status = int(volume_status[volname]
+ [brick_node][brick_path]['status'])
+ except KeyError:
+ continue
if status == 1:
online_bricks_list.append(brick)