NSXV: Catch exceptions on delete-cascade

While cascade-deleting a LB, there are cases where the backend is
out of sync with the OpenStack DBs.
When the entire LB edge is missing, the result is various exceptions
which should be handled.

Change-Id: I4af46d6cb16dd5ea638b2e53a804b89538d38221
This commit is contained in:
Kobi Samoray 2021-06-30 18:18:29 +03:00
parent e28f9c13fb
commit af3fd782a1
4 changed files with 12 additions and 5 deletions

View File

@ -171,7 +171,7 @@ class EdgeHealthMonitorManagerFromDict(base_mgr.EdgeLoadbalancerBaseManager):
try:
edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1]
except nsxv_exc.RequestBad:
except nsxv_exc.VcnsApiException:
# Pool doesn't exist, so member is obviously gone
LOG.warning('Edge pool %s does not exist on edge %s',
edge_pool_id, edge_id)

View File

@ -126,8 +126,14 @@ class EdgeLoadBalancerManagerFromDict(base_mgr.EdgeLoadbalancerBaseManager):
context.session, binding['edge_id'])
# set LB default rule
lb_common.set_lb_firewall_default_rule(
self.vcns, binding['edge_id'], 'deny')
try:
lb_common.set_lb_firewall_default_rule(
self.vcns, binding['edge_id'], 'deny')
except nsxv_exc.VcnsApiException as e:
LOG.error('Failed to set loadbalancer %(lb)s '
'FW rule. exception is %(exc)s',
{'lb': lb['id'], 'exc': e})
if edge_binding:
old_lb = lb_common.is_lb_on_router_edge(
context, self.core_plugin, binding['edge_id'])

View File

@ -216,7 +216,7 @@ class EdgeMemberManagerFromDict(base_mgr.EdgeLoadbalancerBaseManager):
edge_pool_id = pool_binding['edge_pool_id']
try:
edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1]
except nsxv_exc.RequestBad:
except nsxv_exc.VcnsApiException:
# Pool doesn't exist, so member is obviously gone
LOG.warning('Edge pool %s does not exist on edge %s',
edge_pool_id, edge_id)

View File

@ -393,7 +393,8 @@ class NSXOctaviaListenerEndpoint(object):
loadbalancer,
delete=True, cascade=True))
except Exception as e:
LOG.error('NSX driver loadbalancer_delete_cascade failed %s', e)
LOG.error('NSX driver loadbalancer_delete_cascade failed (%s) %s',
type(e), e)
completor(success=False)
return False
return True