summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorSakshi <sabansal@redhat.com>2015-05-05 10:55:56 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-02-29 20:54:20 -0800
commit0cdfd1aa02b0f5f6483fd56625bc032060694a93 (patch)
tree7cf27421c993c4f966afd18b693f6c02e87f36d9 /cli
parent080af56a02aeec20899ecbc7202a8d293378c1f9 (diff)
cli: output of rebalance to show run time in proper format
Backport of http://review.gluster.org/#/c/10544/ Modified tests to parse the new rebalance time format. > Change-Id: I775f13c8046dd2aeb9d4b86a737dcebb396778b4 > BUG: 1223625 > Signed-off-by: Sakshi Bansal <sabansal@redhat.com> > Reviewed-on: http://review.gluster.org/10544 > Smoke: Gluster Build System <jenkins@build.gluster.com> > CentOS-regression: Gluster Build System <jenkins@build.gluster.com> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: N Balachandran <nbalacha@redhat.com> > Reviewed-by: Raghavendra G <rgowdapp@redhat.com> BUG: 1311822 Change-Id: I3c8106f7a1309f154861ce1b3efa202fa6c47c57 Signed-off-by: Sakshi Bansal <sabansal@redhat.com> Reviewed-on: http://review.gluster.org/13514 Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Tested-by: Raghavendra Talur <rtalur@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-rpc-ops.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 416b1e0..5bbf647 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -1525,6 +1525,9 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type)
double elapsed = 0;
char *status_str = NULL;
char *size_str = NULL;
+ int hrs = 0;
+ int min = 0;
+ int sec = 0;
ret = dict_get_int32 (dict, "count", &count);
if (ret) {
@@ -1535,7 +1538,7 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type)
cli_out ("%40s %16s %13s %13s %13s %13s %20s %18s", "Node",
"Rebalanced-files", "size", "scanned", "failures", "skipped",
- "status", "run time in secs");
+ "status", "run time in h:m:s");
cli_out ("%40s %16s %13s %13s %13s %13s %20s %18s", "---------",
"-----------", "-----------", "-----------", "-----------",
"-----------", "------------", "--------------");
@@ -1622,16 +1625,20 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type)
status_str = cli_vol_task_status_str[status_rcd];
size_str = gf_uint64_2human_readable(size);
+ hrs = elapsed / 3600;
+ min = ((int) elapsed % 3600) / 60;
+ sec = ((int) elapsed % 3600) % 60;
+
if (size_str) {
cli_out ("%40s %16"PRIu64 " %13s" " %13"PRIu64 " %13"
- PRIu64" %13"PRIu64 " %20s %18.2f", node_name,
- files, size_str, lookup, failures, skipped,
- status_str, elapsed);
+ PRIu64" %13"PRIu64 " %20s %8d:%d:%d",
+ node_name, files, size_str, lookup, failures,
+ skipped, status_str, hrs, min, sec);
} else {
cli_out ("%40s %16"PRIu64 " %13"PRIu64 " %13"PRIu64
- " %13"PRIu64" %13"PRIu64 " %20s %18.2f",
+ " %13"PRIu64" %13"PRIu64 " %20s %8d:%d:%d",
node_name, files, size, lookup, failures,
- skipped, status_str, elapsed);
+ skipped, status_str, hrs, min, sec);
}
GF_FREE(size_str);
}