From a3d2538da2470e82e0c389ddaf33d1d132172c50 Mon Sep 17 00:00:00 2001 From: kshithijiyer Date: Thu, 4 Apr 2019 16:44:53 +0530 Subject: 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 Change-Id: Ia26208a52e4197050421bc34b9b8cdaf74ac4da6 --- glustolibs-gluster/glustolibs/gluster/brick_libs.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'glustolibs-gluster/glustolibs/gluster') diff --git a/glustolibs-gluster/glustolibs/gluster/brick_libs.py b/glustolibs-gluster/glustolibs/gluster/brick_libs.py index 270b378c1..f84085969 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) -- cgit