From cb9f6652962bf88f1061d981736e7e02e5608a23 Mon Sep 17 00:00:00 2001 From: Nigel Babu Date: Wed, 25 Apr 2018 17:22:41 +0530 Subject: Fix cyclic import in brickmux_ops.py Change-Id: I487822efd6c57b8c51b65b4eaf149eb67e96731b --- .../glustolibs/gluster/brick_libs.py | 22 ++++++++-------------- .../glustolibs/gluster/brickmux_ops.py | 10 +++++----- 2 files changed, 13 insertions(+), 19 deletions(-) (limited to 'glustolibs-gluster') diff --git a/glustolibs-gluster/glustolibs/gluster/brick_libs.py b/glustolibs-gluster/glustolibs/gluster/brick_libs.py index f3e18ec86..67496b88a 100644 --- a/glustolibs-gluster/glustolibs/gluster/brick_libs.py +++ b/glustolibs-gluster/glustolibs/gluster/brick_libs.py @@ -69,13 +69,11 @@ def get_all_bricks(mnode, volname): "for the volume: %s", brick, volname) return None return all_bricks - else: - g.log.error("Bricks not found in Bricks section of volume " - "info for the volume %s", volname) - return None - else: - g.log.error("Bricks not found for the volume %s", volname) + g.log.error("Bricks not found in Bricks section of volume " + "info for the volume %s", volname) return None + g.log.error("Bricks not found for the volume %s", volname) + return None def get_hot_tier_bricks(mnode, volname): @@ -199,7 +197,7 @@ def bring_bricks_offline(volname, bricks_list, brick_node, brick_path = brick.split(":") cmd = ("pgrep glusterfsd") _, out, _ = g.run(brick_node, cmd) - if(len(out.split()) > 1): + if len(out.split()) > 1: cmd = ("ps -eaf | grep glusterfsd | " " grep %s.%s | grep -o '/var/run/gluster/.*' | " " awk '{ print $3 }' | grep -v 'awk' " @@ -634,9 +632,7 @@ def select_tier_volume_bricks_to_bring_offline(mnode, volname): (mnode, volname)) bricks_to_bring_offline['hot_tier_bricks'] = hot_tier_bricks bricks_to_bring_offline['cold_tier_bricks'] = cold_tier_bricks - return bricks_to_bring_offline - else: - return bricks_to_bring_offline + return bricks_to_bring_offline def select_hot_tier_bricks_to_bring_offline(mnode, volname): @@ -793,10 +789,8 @@ def get_bricks_to_bring_offline_from_replicated_volume(subvols_list, "%s", quorum_info) return list_of_bricks_to_bring_offline - """ - offline_bricks_limit: Maximum Number of bricks that can be offline without - affecting the cluster - """ + # offline_bricks_limit: Maximum Number of bricks that can be offline + # without affecting the cluster if is_quorum_applicable: if 'fixed' in quorum_type: if quorum_count is None: diff --git a/glustolibs-gluster/glustolibs/gluster/brickmux_ops.py b/glustolibs-gluster/glustolibs/gluster/brickmux_ops.py index 2fa4687b9..3fcb4ee59 100644 --- a/glustolibs-gluster/glustolibs/gluster/brickmux_ops.py +++ b/glustolibs-gluster/glustolibs/gluster/brickmux_ops.py @@ -20,7 +20,7 @@ """ from glusto.core import Glusto as g -from glustolibs.gluster.brick_libs import get_all_bricks +import glustolibs.gluster.brick_libs from glustolibs.gluster.volume_ops import get_volume_status @@ -35,11 +35,10 @@ def is_brick_mux_enabled(mnode): """ cmd = ("gluster v get all all | grep cluster.brick-multiplex |" "awk '{print $2}'") - ret, out, err = g.run(mnode, cmd) + _, out, _ = g.run(mnode, cmd) if "enable" in out: return True - else: - return False + return False def enable_brick_mux(mnode): @@ -72,7 +71,8 @@ def check_brick_pid_matches_glusterfsd_pid(mnode, volname): bool : True if pid's matches. False otherwise. """ _rc = True - bricks_list = get_all_bricks(mnode, volname) + bricks_list = glustolibs.gluster.brick_libs.get_all_bricks(mnode, + volname) for brick in bricks_list: brick_node, brick_path = brick.split(":") ret = get_volume_status(mnode, volname) -- cgit