summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMilind Changire <mchangir@redhat.com>2015-05-27 16:50:09 +0530
committerVenky Shankar <vshankar@redhat.com>2015-06-04 00:08:48 -0700
commitc2898f040937492c69a603ab3605cbd441e1e1f3 (patch)
tree7514861036b56be497d21f86df065cca6faac844 /tools
parentb15ee49c94c07ffd3c27384b45840eafd59997d4 (diff)
tools/glusterfind: verifying volume presence
An invalid volume name passed to "pre", "post" and "delete" operations throws up unfriendly errors. This patch presents friendly error messages. Change-Id: I233809653379b80b34c2e74c0b6f4fe502c8961e BUG: 1225424 Signed-off-by: Milind Changire <mchangir@redhat.com> Reviewed-on: http://review.gluster.org/10945 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Aravinda VK <avishwan@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/glusterfind/src/main.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/glusterfind/src/main.py b/tools/glusterfind/src/main.py
index d9936eebde1..ccd2d2297cb 100644
--- a/tools/glusterfind/src/main.py
+++ b/tools/glusterfind/src/main.py
@@ -179,6 +179,11 @@ def get_nodes(volume):
logger=logger)
tree = etree.fromstring(data)
+ # Test to check if volume has been deleted after session creation
+ count_el = tree.find('volInfo/volumes/count')
+ if int(count_el.text) == 0:
+ fail("Unable to get volume details", logger=logger)
+
nodes = []
volume_el = tree.find('volInfo/volumes/volume')
try:
@@ -506,6 +511,11 @@ def main():
if not os.path.exists(session_dir) and args.mode not in ["create", "list"]:
fail("Invalid session %s" % args.session)
+ vol_dir = os.path.join(session_dir, args.volume)
+ if not os.path.exists(vol_dir) and args.mode not in ["create", "list"]:
+ fail("Session %s not created with volume %s" %
+ (args.session, args.volume))
+
mkdirp(os.path.join(conf.get_opt("log_dir"), args.session, args.volume),
exit_on_err=True)
log_file = os.path.join(conf.get_opt("log_dir"),