From 414d6d378b7d63b172859f619bd3ffb72bd3f434 Mon Sep 17 00:00:00 2001 From: N Balachandran Date: Tue, 8 Aug 2017 23:11:10 +0530 Subject: [PATCH 418/444] cli: correct rebalance status elapsed check Check that elapsed time has crossed 10 mins for at least one rebalance process before displaying the estimates. Upstream patch: https://review.gluster.org/#/c/glusterfs/+/18000/ > Change-Id: Ib357a6f0d0125a178e94ede1e31514fdc6ce3593 > BUG: 1479528 > Signed-off-by: N Balachandran Change-Id: Ic4606acad991b9369c6b674691e0ec15621c6932 BUG: 1479446 Signed-off-by: N Balachandran Reviewed-on: https://code.engineering.redhat.com/gerrit/154929 Tested-by: RHGS Build Bot Reviewed-by: Atin Mukherjee --- cli/src/cli-rpc-ops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 10f772c..5623950 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -1616,6 +1616,7 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type, gf_boolean_t down = _gf_false; gf_boolean_t fix_layout = _gf_false; uint64_t max_time = 0; + uint64_t max_elapsed = 0; uint64_t time_left = 0; gf_boolean_t show_estimates = _gf_false; @@ -1758,6 +1759,9 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type, gf_log ("cli", GF_LOG_TRACE, "failed to get time left"); + if (elapsed > max_elapsed) + max_elapsed = elapsed; + if (time_left > max_time) max_time = time_left; @@ -1818,7 +1822,7 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type, if (!show_estimates) { goto out; } - if (elapsed <= REBAL_ESTIMATE_START_TIME) { + if (max_elapsed <= REBAL_ESTIMATE_START_TIME) { cli_out ("The estimated time for rebalance to complete " "will be unavailable for the first 10 " "minutes."); -- 1.8.3.1