Browse Source

Octavia: retry update status on exception

When the Octavia driver agent status update results with an exception,
the driver should retry.

Change-Id: Ia42e99a311b872ed87efbaaf93eb375a7620f740
changes/18/787218/6
Kobi Samoray 3 weeks ago
parent
commit
36768b21c4
1 changed files with 18 additions and 2 deletions
  1. +18
    -2
      vmware_nsx/services/lbaas/octavia/octavia_driver.py

+ 18
- 2
vmware_nsx/services/lbaas/octavia/octavia_driver.py View File

@ -23,6 +23,7 @@ from oslo_log import helpers as log_helpers
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_messaging.rpc import dispatcher
import tenacity
from octavia.api.drivers import utils as oct_utils
from octavia.db import api as db_apis
@ -42,6 +43,12 @@ TRANSPORT = None
RPC_SERVER = None
def _log_before_retry(retry_state):
if retry_state.attempt_number > 0:
LOG.warning("Retrying the call to _update_loadbalancer_status due to "
"timeout")
def get_transport():
global TRANSPORT
if not TRANSPORT:
@ -674,12 +681,21 @@ class NSXOctaviaDriverEndpoint(driver_lib.DriverLibrary):
self._removed_not_in_db(status, 'pools', 'pool')
try:
return super(NSXOctaviaDriverEndpoint,
self).update_loadbalancer_status(status)
return self._update_loadbalancer_status(status)
except exceptions.UpdateStatusError as e:
LOG.error("Failed to update Octavia loadbalancer status. "
"Status %s, Error %s", status, e.fault_string)
@tenacity.retry(
stop=tenacity.stop_after_attempt(30), reraise=True,
wait=tenacity.wait_exponential(multiplier=1, min=1, max=5),
before=_log_before_retry,
retry=tenacity.retry_if_exception_type(
exceptions.UpdateStatusError))
def _update_loadbalancer_status(self, status):
super(NSXOctaviaDriverEndpoint,
self).update_loadbalancer_status(status)
@log_helpers.log_method_call
def update_listener_statistics(self, ctxt, statistics):
# refresh the driver lib session


Loading…
Cancel
Save