LBaaSv2: Delete LB even when backend is broken
When backend if inconsistent with the Neutron DB, we should still be able to delete the LB, while posting a proper error message. Change-Id: Ice5b2bba255297711a620f61e75cafce0115ae93 Fixes-bug: #1663602
This commit is contained in:
parent
0f8acc0c4b
commit
5a3008b75b
@ -68,23 +68,27 @@ class EdgeLoadBalancerManager(base_mgr.EdgeLoadbalancerBaseManager):
|
||||
|
||||
@log_helpers.log_method_call
|
||||
def delete(self, context, lb):
|
||||
try:
|
||||
binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding(
|
||||
context.session, lb.id)
|
||||
if binding:
|
||||
try:
|
||||
lb_common.del_vip_fw_rule(self.vcns, binding['edge_id'],
|
||||
binding['edge_fw_rule_id'])
|
||||
except nsxv_exc.VcnsApiException as e:
|
||||
LOG.error(_LE('Failed to delete loadbalancer %(lb)s FW rule. '
|
||||
'exception is %(exc)s'), {'lb': lb.id, 'exc': e})
|
||||
try:
|
||||
lb_common.del_vip_as_secondary_ip(self.vcns,
|
||||
binding['edge_id'],
|
||||
lb.vip_address)
|
||||
nsxv_db.del_nsxv_lbaas_loadbalancer_binding(context.session,
|
||||
lb.id)
|
||||
self.lbv2_driver.load_balancer.successful_completion(
|
||||
context, lb, delete=True)
|
||||
except nsxv_exc.VcnsApiException:
|
||||
with excutils.save_and_reraise_exception():
|
||||
self.lbv2_driver.load_balancer.failed_completion(context, lb)
|
||||
LOG.error(_LE('Failed to delete pool %s'), lb.id)
|
||||
except Exception as e:
|
||||
LOG.error(_LE('Failed to delete loadbalancer %(lb)s interface'
|
||||
' IP. exception is %(exc)s'),
|
||||
{'lb': lb.id, 'exc': e})
|
||||
|
||||
nsxv_db.del_nsxv_lbaas_loadbalancer_binding(context.session, lb.id)
|
||||
self.lbv2_driver.load_balancer.successful_completion(context, lb,
|
||||
delete=True)
|
||||
|
||||
@log_helpers.log_method_call
|
||||
def refresh(self, context, lb):
|
||||
|
Loading…
Reference in New Issue
Block a user