diff options
author | N Balachandran <nbalacha@redhat.com> | 2017-01-17 15:43:47 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-01-24 08:22:35 -0500 |
commit | 55dff8a4ff3ba97f3e6071a374ec59011eacbe26 (patch) | |
tree | 28a7f47ccbd0a35b74741d1c0d9cc4416bed1eb4 /cli | |
parent | e549df2c0d8b5dbfa6e9c129109185aaf4cea11d (diff) |
dht/rebalance Estimate time to complete rebalance
The estimates will be logged to the rebalance log on running
gluster v rebalance <vol> status
> Change-Id: I9d51b139cd4c8dfde1ff2c2050720ae606c13fc6
> BUG: 1396004
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
> Reviewed-on: http://review.gluster.org/15893
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
(cherry picked from commit 2edd75ec8de17da89004859375844f60890a4df0)
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Change-Id: I58b0550210149443966798d9a26e73cb598eeb6a
BUG: 1415915
Reviewed-on: https://review.gluster.org/16458
Tested-by: N Balachandran <nbalacha@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 59a1a4c1266..b56457ecf63 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -1608,6 +1608,9 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type, int sec = 0; gf_boolean_t down = _gf_false; gf_boolean_t fix_layout = _gf_false; + uint64_t max_time = 0; + uint64_t time_left = 0; + ret = dict_get_int32 (dict, "count", &count); if (ret) { @@ -1660,6 +1663,7 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type, skipped = 0; status_str = NULL; elapsed = 0; + time_left = 0; /* Check if status is NOT_STARTED, and continue early */ memset (key, 0, 256); @@ -1737,6 +1741,15 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type, if (ret) gf_log ("cli", GF_LOG_TRACE, "failed to get run-time"); + memset (key, 0, 256); + snprintf (key, 256, "time-left-%d", i); + ret = dict_get_uint64 (dict, key, &time_left); + if (ret) + gf_log ("cli", GF_LOG_TRACE, + "failed to get time left"); + if (time_left > max_time) + max_time = time_left; + /* Check for array bound */ if (status_rcd >= GF_DEFRAG_STATUS_MAX) status_rcd = GF_DEFRAG_STATUS_MAX; @@ -1754,15 +1767,15 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type, if (size_str) { cli_out ("%40s %16"PRIu64 " %13s" " %13"PRIu64 " %13" PRIu64" %13"PRIu64 " %20s " - "%8d:%d:%d", node_name, files, + "%8d:%02d:%02d", 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" - " %8d:%d:%d", node_name, files, size, - lookup, failures, skipped, status_str, - hrs, min, sec); + " %8d:%02d:%02d", node_name, files, + size, lookup, failures, skipped, + status_str, hrs, min, sec); } } GF_FREE(size_str); @@ -1772,6 +1785,13 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type, " Please check the nodes that are down using \'gluster" " peer status\' and start the glusterd on those nodes," " else tier detach commit might fail!"); + if (max_time) { + hrs = max_time / 3600; + min = ((int) max_time % 3600) / 60; + sec = ((int) max_time % 3600) % 60; + cli_out ("Estimated time left for rebalance to complete :" + " %8d:%02d:%02d", hrs, min, sec); + } out: return ret; } |