From e641245cf14f6dc014229805aecb88434bba6a0e Mon Sep 17 00:00:00 2001 From: Valerii Ponomarov Date: Sat, 14 Sep 2019 01:34:17 +0530 Subject: Fix multiple usages of waiters Fix consists of 2 parts: - Calculate correctly left time for waiting in 'scale_dcs_pod_amount_and_wait' function. Before, it had bug, where we were waiting less time than requested. And it led to the unexpected timeout errors. Example: it could fail waiting only 180sec having 600sec as real timeout. - Reset 'attempts' on the instantiated 'waiter's to avoid redundant waiting reusing the single waiter instance. Example. On deletion of 20 PVCs we save about 1,5 minutes. In whole test suite we create much more PVCs than 20. Change-Id: I5d06a63dd0c2c5bd67fdb09fef87948d65e6bf22 --- openshift-storage-libs/openshiftstoragelibs/gluster_ops.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'openshift-storage-libs/openshiftstoragelibs/gluster_ops.py') diff --git a/openshift-storage-libs/openshiftstoragelibs/gluster_ops.py b/openshift-storage-libs/openshiftstoragelibs/gluster_ops.py index 1e80149d..785bde58 100644 --- a/openshift-storage-libs/openshiftstoragelibs/gluster_ops.py +++ b/openshift-storage-libs/openshiftstoragelibs/gluster_ops.py @@ -36,6 +36,9 @@ def wait_to_heal_complete(timeout=300, wait_step=5): for gluster_vol in gluster_vol_list: for w in _waiter: if is_heal_complete("auto_get_gluster_endpoint", gluster_vol): + # NOTE(vponomar): Reset attempts for waiter to avoid redundant + # sleep equal to 'interval' on the next usage. + _waiter._attempt = 0 break if w.expired: -- cgit