diff options
author | Varun Shastry <vshastry@redhat.com> | 2012-08-14 14:21:30 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-08-19 09:40:16 -0700 |
commit | 602b0193775bc78768390be08488c3b0aa5601fb (patch) | |
tree | 83898b14f9a65e97fa2fac4ac7a41f681d393aaa /cli/src/cli-rpc-ops.c | |
parent | 3e62998978d3e6735a1857b4082e8c39dfd327d2 (diff) |
cli/: Displaying the size in human readable format
rebalance status displaying the size in bytes. Converted to
human readable
Change-Id: Ie39938970f92bf7507db2a6de4d5958408f3892c
BUG: 825193
Signed-off-by: Varun Shastry <vshastry@redhat.com>
Reviewed-on: http://review.gluster.com/3781
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Diffstat (limited to 'cli/src/cli-rpc-ops.c')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 92361e6debb..a1a243b7332 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -1045,6 +1045,7 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov, int32_t i = 1; uint64_t failures = 0; double elapsed = 0; + char *size_str = NULL; if (-1 == req->rpc_status) { goto out; @@ -1146,9 +1147,9 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov, cli_out ("%40s %16s %13s %13s %13s %14s %s", "Node", "Rebalanced-files", "size", "scanned", "failures", "status", "run time in secs"); - cli_out ("%40s %16s %13s %13s %13s %14s %14s", "---------", + cli_out ("%40s %16s %13s %13s %13s %14s %16s", "---------", "-----------", "-----------", "-----------", "-----------", - "------------", "-----------"); + "------------", "--------------"); do { snprintf (key, 256, "node-uuid-%d", i); ret = dict_get_str (dict, key, &node_uuid); @@ -1215,9 +1216,13 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov, status = "failed"; break; } - cli_out ("%40s %16"PRIu64 "%13"PRIu64 "%13"PRIu64 "%13"PRIu64 - " %14s %14.2f", node_uuid, files, size, lookup, + + size_str = gf_uint64_2human_readable(size); + cli_out ("%40s %16"PRIu64 " %13s" " %13"PRIu64 " %13"PRIu64 + " %14s %16.2f", node_uuid, files, size_str, lookup, failures, status, elapsed); + GF_FREE(size_str); + i++; } while (i <= counter); @@ -1482,7 +1487,7 @@ gf_cli3_remove_brick_status_cbk (struct rpc_req *req, struct iovec *iov, gf_defrag_status_t status_rcd = GF_DEFRAG_STATUS_NOT_STARTED; uint64_t failures = 0; double elapsed = 0; - + char *size_str = NULL; if (-1 == req->rpc_status) { goto out; @@ -1530,9 +1535,9 @@ gf_cli3_remove_brick_status_cbk (struct rpc_req *req, struct iovec *iov, cli_out ("%40s %16s %13s %13s %13s %14s %s", "Node", "Rebalanced-files", "size", "scanned", "failures", "status", "run-time in secs"); - cli_out ("%40s %16s %13s %13s %13s %14s %14s", "---------", + cli_out ("%40s %16s %13s %13s %13s %14s %16s", "---------", "-----------", "-----------", "-----------", "-----------", - "------------", "------------"); + "------------", "--------------"); do { snprintf (key, 256, "node-uuid-%d", i); @@ -1599,9 +1604,13 @@ gf_cli3_remove_brick_status_cbk (struct rpc_req *req, struct iovec *iov, status = "failed"; break; } - cli_out ("%40s %16"PRIu64 "%13"PRIu64 "%13"PRIu64 "%13"PRIu64 - " %14s %14.2f", node_uuid, files, size, lookup, + + size_str = gf_uint64_2human_readable(size); + cli_out ("%40s %16"PRIu64 " %13s" " %13"PRIu64 " %13"PRIu64 + " %14s %16.2f", node_uuid, files, size_str, lookup, failures, status, elapsed); + GF_FREE(size_str); + i++; } while (i <= counter); |