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-11 02:37:32 -0700
commit3f63ace15d524490e23c82f920c4c83bc6d95622 (patch)
tree3f1140a6d5b70eb4b5b6c07662d9e5db562ff5f5 /tools
parentd4f9640a08c10beb4cedfefba0a91528b47867e7 (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: 1225548 Reviewed On: http://review.gluster.org/#/c/10945/ Signed-off-by: Milind Changire <mchangir@redhat.com> Reviewed-on: http://review.gluster.org/10989 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"),