summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMilind Changire <mchangir@redhat.com>2015-05-28 11:22:50 +0530
committerVijay Bellur <vbellur@redhat.com>2015-06-11 12:06:41 -0700
commita8ab5a2c1ed8dba170f628688881905313e3a8e7 (patch)
tree71fe06e25ac8ea2e1f580630412d9575d371425c /tools
parent0bb51f8a620cb059ed94bcba10d5f3d285f04371 (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: 1225565 Reviewed-On: http://review.gluster.org/#/c/10955/ Signed-off-by: Milind Changire <mchangir@redhat.com> Reviewed-on: http://review.gluster.org/11187 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/glusterfind/src/main.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/glusterfind/src/main.py b/tools/glusterfind/src/main.py
index ccd2d22..16dc18b 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: