MP2P: Reduce max polling time for migrator to 2 secs

Also enable exponential backoff with intervals starting at
0.1 seconds.

Change-Id: I8f2358a4c8334f5df4b5cd29396a7ca77305a6d5
This commit is contained in:
Salvatore Orlando 2021-10-05 10:25:58 -07:00 committed by Salvatore Orlando
parent 9059e7e4a0
commit 6184264d39
1 changed files with 11 additions and 3 deletions

View File

@ -214,6 +214,8 @@ def verify_component_status(nsxlib, component_number):
def wait_for_component_success(nsxlib, component_number):
delay = 0.1
max_delay = 2.0
while True:
status = get_migration_status(nsxlib)
try:
@ -224,19 +226,25 @@ def wait_for_component_success(nsxlib, component_number):
component_number, status)
if component_status == POLICY_API_STATUS_SUCCESS:
return
LOG.debug("Component #%d status is %s. Waiting 5 seconds",
LOG.debug("Component #%d status is %s. Waiting 1 second",
component_number, component_status)
time.sleep(5)
time.sleep(delay)
delay = min(delay * 2, max_delay)
def wait_on_overall_migration_status_to_pause(nsxlib):
delay = 0.1
max_delay = 2.0
while True:
status = get_migration_status(nsxlib)
migration_status = status.get('overall_migration_status')
if (migration_status == POLICY_API_STATUS_PAUSED or
migration_status == POLICY_API_STATUS_SUCCESS):
break
time.sleep(5)
LOG.debug("Overall migration status is %s. Waiting 1 second.",
migration_status)
time.sleep(delay)
delay = min(delay * 2, max_delay)
def printable_resource_name(resource):