From 53e84fe1eec8770936e7fdfb7246925006566f41 Mon Sep 17 00:00:00 2001 From: Milind Changire Date: Thu, 28 May 2015 11:22:50 +0530 Subject: tools/glusterfind: verifying volume is online Volume needs to be online (Started) to perform meaningful operations i.e. for "create" and "pre". This is now verified. Change-Id: I207cf1f5e30be0f67a776b866349b59d70a13984 BUG: 1225564 Signed-off-by: Milind Changire Reviewed-on: http://review.gluster.org/10955 Tested-by: NetBSD Build System Reviewed-by: Aravinda VK --- tools/glusterfind/src/main.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tools/glusterfind') diff --git a/tools/glusterfind/src/main.py b/tools/glusterfind/src/main.py index ccd2d2297cb..16dc18bd732 100644 --- a/tools/glusterfind/src/main.py +++ b/tools/glusterfind/src/main.py @@ -31,6 +31,7 @@ ParseError = etree.ParseError if hasattr(etree, 'ParseError') else SyntaxError logger = logging.getLogger() node_outfiles = [] +vol_statusStr = "Stopped" class StoreAbsPath(Action): @@ -87,6 +88,10 @@ def run_cmd_nodes(task, args, **kwargs): "tmp_output_%s" % num) if task == "pre": + if vol_statusStr == "Stopped": + fail("Volume %s is in stopped state" % args.volume, + logger=logger) + # If Full backup is requested or start time is zero, use brickfind change_detector = conf.get_change_detector("changelog") if args.full: @@ -123,6 +128,10 @@ def run_cmd_nodes(task, args, **kwargs): args.session, args.volume] + (["--debug"] if args.debug else []) elif task == "create": + if vol_statusStr == "Stopped": + fail("Volume %s is in stopped state" % args.volume, + logger=logger) + # When glusterfind create, create session directory in # each brick nodes cmd = [conf.get_opt("nodeagent"), @@ -173,6 +182,8 @@ def get_nodes(volume): Get the gluster volume info xml output and parse to get the brick details. """ + global vol_statusStr; + cmd = ["gluster", 'volume', 'info', volume, "--xml"] _, data, _ = execute(cmd, exit_msg="Failed to Run Gluster Volume Info", @@ -184,6 +195,9 @@ def get_nodes(volume): if int(count_el.text) == 0: fail("Unable to get volume details", logger=logger) + # this status is used in caller: run_cmd_nodes + vol_statusStr = tree.find('volInfo/volumes/volume/statusStr').text + nodes = [] volume_el = tree.find('volInfo/volumes/volume') try: -- cgit