Update wait_for_octavia_service function
Change-Id: Ibfa03c3b7e580799004c16e8814b5042fc34d8be
This commit is contained in:
parent
a89b220c98
commit
4e47800f30
@ -28,6 +28,4 @@ class TimeoutException(tobiko.TobikoException):
|
||||
message = "Timeout exception: {reason}"
|
||||
|
||||
|
||||
class OctaviaClientException(tobiko.TobikoException,
|
||||
exceptions.OctaviaClientException):
|
||||
message = "Octavia client error: {reason}"
|
||||
OctaviaClientException = exceptions.OctaviaClientException
|
||||
|
@ -144,24 +144,21 @@ def wait_for_lb_to_be_updated_and_active(loadbalancer_id):
|
||||
|
||||
|
||||
def wait_for_octavia_service(loadbalancer_id: str,
|
||||
waiting_msg='Waiting for the LB to become '
|
||||
'functional again...',
|
||||
interval: tobiko.Seconds = None,
|
||||
timeout: tobiko.Seconds = None,
|
||||
count: int = 10):
|
||||
|
||||
LOG.info(waiting_msg)
|
||||
client=None):
|
||||
for attempt in tobiko.retry(timeout=timeout,
|
||||
interval=interval,
|
||||
count=count):
|
||||
default_timeout=180.,
|
||||
default_interval=5.):
|
||||
try:
|
||||
octavia.list_amphorae(loadbalancer_id=loadbalancer_id)
|
||||
LOG.info('Octavia service is available!')
|
||||
return
|
||||
except Exception as ex:
|
||||
if issubclass(octavia.OctaviaClientException, ex.__class__):
|
||||
LOG.info(waiting_msg)
|
||||
octavia.list_amphorae(loadbalancer_id=loadbalancer_id,
|
||||
client=client)
|
||||
except octavia.OctaviaClientException as ex:
|
||||
LOG.debug(f"Error listing amphorae: {ex}")
|
||||
if attempt.is_last:
|
||||
raise
|
||||
LOG.info('Waiting for the LB to become functional again...')
|
||||
else:
|
||||
raise ex
|
||||
LOG.info('Octavia service is available!')
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user