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