From 43700ed04c1bac15f5df3702410c83fb63607476 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Thu, 31 Mar 2011 03:31:00 +0000 Subject: cli: Improve profile output messages Signed-off-by: Pranith Kumar K Signed-off-by: Vijay Bellur BUG: 2616 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2616 --- cli/src/cli-rpc-ops.c | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) (limited to 'cli/src') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 503611a8795..92658af4735 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -3043,6 +3043,7 @@ gf_cli3_1_profile_volume_cbk (struct rpc_req *req, struct iovec *iov, int interval = 0; int i = 1; int32_t brick_count = 0; + char *volname = NULL; if (-1 == req->rpc_status) { goto out; } @@ -3054,18 +3055,6 @@ gf_cli3_1_profile_volume_cbk (struct rpc_req *req, struct iovec *iov, goto out; } - if (rsp.op_ret && strcmp (rsp.op_errstr, "")) { - cli_out (rsp.op_errstr); - } else { - cli_out ("volume profile %s ", - (rsp.op_ret) ? "unsuccessful": "successful"); - } - - if (rsp.op_ret) { - ret = rsp.op_ret; - goto out; - } - dict = dict_new (); if (!dict) { @@ -3085,7 +3074,42 @@ gf_cli3_1_profile_volume_cbk (struct rpc_req *req, struct iovec *iov, dict->extra_stdfree = rsp.stats_info.stats_info_val; } + ret = dict_get_str (dict, "volname", &volname); + if (ret) + goto out; + ret = dict_get_int32 (dict, "op", (int32_t*)&op); + if (ret) + goto out; + + if (rsp.op_ret && strcmp (rsp.op_errstr, "")) { + cli_out (rsp.op_errstr); + } else { + switch (op) { + case GF_CLI_STATS_START: + cli_out ("Starting volume profile on %s has been %s ", + volname, + (rsp.op_ret) ? "unsuccessful": "successful"); + break; + case GF_CLI_STATS_STOP: + cli_out ("Stopping volume profile on %s has been %s ", + volname, + (rsp.op_ret) ? "unsuccessful": "successful"); + break; + case GF_CLI_STATS_INFO: + break; + default: + cli_out ("volume profile on %s has been %s ", + volname, + (rsp.op_ret) ? "unsuccessful": "successful"); + break; + } + } + + if (rsp.op_ret) { + ret = rsp.op_ret; + goto out; + } if (op != GF_CLI_STATS_INFO) { ret = 0; -- cgit