diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2011-03-31 03:31:00 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2011-03-31 04:20:09 -0700 |
commit | 43700ed04c1bac15f5df3702410c83fb63607476 (patch) | |
tree | 7cef18d734c1784b62f90e0f14e2ca7bce2e3955 /cli | |
parent | 215a8352e2219c7ead29693ccab3452054a89041 (diff) |
cli: Improve profile output messages
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 2616 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2616
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 503611a87..92658af47 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; |