summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMilind Changire <mchangir@redhat.com>2015-06-10 12:50:50 +0530
committerVijay Bellur <vbellur@redhat.com>2015-06-13 21:53:12 -0700
commite645c65ad3cba84a881985d01c5efd971eda1889 (patch)
treeca3cfa4c6599f20943b8fd5bf4d518fbe946dc05 /tools
parent1675c4ccf6d515198bd732a129ad117aca1c74e3 (diff)
tools/glusterfind: print message for good cases
Added messages for printing status of good or default cases for 'create', 'list', 'post' and 'delete' commands Change-Id: I59a9219250536bdce1deaca4b6d2351a6e278af2 BUG: 1230791 Reviewed-On: http://review.gluster.org/11208 Signed-off-by: Milind Changire <mchangir@redhat.com> Reviewed-on: http://review.gluster.org/11189 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Aravinda VK <avishwan@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/glusterfind/src/main.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/tools/glusterfind/src/main.py b/tools/glusterfind/src/main.py
index 5d5058f..29fa28b 100644
--- a/tools/glusterfind/src/main.py
+++ b/tools/glusterfind/src/main.py
@@ -90,7 +90,7 @@ def run_cmd_nodes(task, args, **kwargs):
if task == "pre":
if vol_statusStr == "Stopped":
fail("Volume %s is in stopped state" % args.volume,
- logger=logger)
+ logger=logger)
# If Full backup is requested or start time is zero, use brickfind
change_detector = conf.get_change_detector("changelog")
@@ -130,7 +130,7 @@ def run_cmd_nodes(task, args, **kwargs):
elif task == "create":
if vol_statusStr == "Stopped":
fail("Volume %s is in stopped state" % args.volume,
- logger=logger)
+ logger=logger)
# When glusterfind create, create session directory in
# each brick nodes
@@ -182,7 +182,7 @@ def get_nodes(volume):
Get the gluster volume info xml output and parse to get
the brick details.
"""
- global vol_statusStr;
+ global vol_statusStr
cmd = ["gluster", 'volume', 'info', volume, "--xml"]
_, data, _ = execute(cmd,
@@ -370,6 +370,9 @@ def mode_create(session_dir, args):
with open(status_file, "w", buffering=0) as f:
f.write(str(time_to_update))
+ sys.stdout.write("Session %s created with volume %s\n" %
+ (args.session, args.volume))
+
sys.exit(0)
@@ -451,6 +454,8 @@ def mode_post(session_dir, args):
if os.path.exists(status_file_pre):
run_cmd_nodes("post", args)
os.rename(status_file_pre, status_file)
+ sys.stdout.write("Session %s with volume %s updated\n" %
+ (args.session, args.volume))
sys.exit(0)
else:
fail("Pre script is not run", logger=logger)
@@ -460,6 +465,8 @@ def mode_delete(session_dir, args):
run_cmd_nodes("delete", args)
shutil.rmtree(os.path.join(session_dir, args.volume),
onerror=handle_rm_error)
+ sys.stdout.write("Session %s with volume %s deleted\n" %
+ (args.session, args.volume))
# If the session contains only this volume, then cleanup the
# session directory. If a session contains multiple volumes
@@ -524,8 +531,11 @@ def mode_list(session_dir, args):
volname.ljust(25),
sess_time.ljust(25)))
- if not output and (args.session or args.volume):
- fail("Invalid Session", logger=logger)
+ if not output:
+ if args.session or args.volume:
+ fail("Invalid Session", logger=logger)
+ else:
+ sys.stdout.write("No sessions found\n")
def main():
@@ -544,7 +554,7 @@ def main():
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))
+ (args.session, args.volume))
mkdirp(os.path.join(conf.get_opt("log_dir"), args.session, args.volume),
exit_on_err=True)