summaryrefslogtreecommitdiffstats
path: root/openshift-storage-libs/openshiftstoragelibs/node_ops.py
diff options
context:
space:
mode:
authorValerii Ponomarov <vponomar@redhat.com>2019-09-14 01:34:17 +0530
committervponomar <vponomar@redhat.com>2019-09-16 14:58:47 +0000
commite641245cf14f6dc014229805aecb88434bba6a0e (patch)
treeda6f1691c9e7432ac9a20e07328acbbe928db0ee /openshift-storage-libs/openshiftstoragelibs/node_ops.py
parent8dd2df0d75b6241da28ee24904ea00b718566360 (diff)
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
Diffstat (limited to 'openshift-storage-libs/openshiftstoragelibs/node_ops.py')
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/node_ops.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/node_ops.py b/openshift-storage-libs/openshiftstoragelibs/node_ops.py
index f456b325..8ca5674b 100644
--- a/openshift-storage-libs/openshiftstoragelibs/node_ops.py
+++ b/openshift-storage-libs/openshiftstoragelibs/node_ops.py
@@ -160,6 +160,9 @@ def power_on_vm_by_name(name, timeout=600, interval=10):
for w in _waiter:
try:
hostname = cloudProvider.wait_for_hostname(name, 1, 1)
+ # NOTE(vponomar): Reset attempts for waiter to avoid redundant
+ # sleep equal to 'interval' on the next usage.
+ _waiter._attempt = 0
break
except Exception as e:
g.log.info(e)