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}"
|
message = "Timeout exception: {reason}"
|
||||||
|
|
||||||
|
|
||||||
class OctaviaClientException(tobiko.TobikoException,
|
OctaviaClientException = exceptions.OctaviaClientException
|
||||||
exceptions.OctaviaClientException):
|
|
||||||
message = "Octavia client error: {reason}"
|
|
||||||
|
@ -144,24 +144,21 @@ def wait_for_lb_to_be_updated_and_active(loadbalancer_id):
|
|||||||
|
|
||||||
|
|
||||||
def wait_for_octavia_service(loadbalancer_id: str,
|
def wait_for_octavia_service(loadbalancer_id: str,
|
||||||
waiting_msg='Waiting for the LB to become '
|
|
||||||
'functional again...',
|
|
||||||
interval: tobiko.Seconds = None,
|
interval: tobiko.Seconds = None,
|
||||||
timeout: tobiko.Seconds = None,
|
timeout: tobiko.Seconds = None,
|
||||||
count: int = 10):
|
client=None):
|
||||||
|
|
||||||
LOG.info(waiting_msg)
|
|
||||||
for attempt in tobiko.retry(timeout=timeout,
|
for attempt in tobiko.retry(timeout=timeout,
|
||||||
interval=interval,
|
interval=interval,
|
||||||
count=count):
|
default_timeout=180.,
|
||||||
|
default_interval=5.):
|
||||||
try:
|
try:
|
||||||
octavia.list_amphorae(loadbalancer_id=loadbalancer_id)
|
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:
|
||||||
LOG.info('Octavia service is available!')
|
LOG.info('Octavia service is available!')
|
||||||
return
|
break
|
||||||
except Exception as ex:
|
|
||||||
if issubclass(octavia.OctaviaClientException, ex.__class__):
|
|
||||||
LOG.info(waiting_msg)
|
|
||||||
if attempt.is_last:
|
|
||||||
raise
|
|
||||||
else:
|
|
||||||
raise ex
|
|
||||||
|
Loading…
Reference in New Issue
Block a user