diff options
author | Milind Changire <mchangir@redhat.com> | 2015-05-28 11:22:50 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-06-11 12:05:56 -0700 |
commit | 53e84fe1eec8770936e7fdfb7246925006566f41 (patch) | |
tree | a532bd60180a03e3c36aa535d762e4512715be6e | |
parent | 46b3fde5437b293d9c0897fe167223b8f4f37c60 (diff) |
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 <mchangir@redhat.com>
Reviewed-on: http://review.gluster.org/10955
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
-rw-r--r-- | tools/glusterfind/src/main.py | 14 |
1 files changed, 14 insertions, 0 deletions
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: |