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
|
@log_helpers.log_method_call
|
||||||
def delete(self, context, lb):
|
def delete(self, context, lb):
|
||||||
try:
|
|
||||||
binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding(
|
binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding(
|
||||||
context.session, lb.id)
|
context.session, lb.id)
|
||||||
if binding:
|
if binding:
|
||||||
|
try:
|
||||||
lb_common.del_vip_fw_rule(self.vcns, binding['edge_id'],
|
lb_common.del_vip_fw_rule(self.vcns, binding['edge_id'],
|
||||||
binding['edge_fw_rule_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,
|
lb_common.del_vip_as_secondary_ip(self.vcns,
|
||||||
binding['edge_id'],
|
binding['edge_id'],
|
||||||
lb.vip_address)
|
lb.vip_address)
|
||||||
nsxv_db.del_nsxv_lbaas_loadbalancer_binding(context.session,
|
except Exception as e:
|
||||||
lb.id)
|
LOG.error(_LE('Failed to delete loadbalancer %(lb)s interface'
|
||||||
self.lbv2_driver.load_balancer.successful_completion(
|
' IP. exception is %(exc)s'),
|
||||||
context, lb, delete=True)
|
{'lb': lb.id, 'exc': e})
|
||||||
except nsxv_exc.VcnsApiException:
|
|
||||||
with excutils.save_and_reraise_exception():
|
nsxv_db.del_nsxv_lbaas_loadbalancer_binding(context.session, lb.id)
|
||||||
self.lbv2_driver.load_balancer.failed_completion(context, lb)
|
self.lbv2_driver.load_balancer.successful_completion(context, lb,
|
||||||
LOG.error(_LE('Failed to delete pool %s'), lb.id)
|
delete=True)
|
||||||
|
|
||||||
@log_helpers.log_method_call
|
@log_helpers.log_method_call
|
||||||
def refresh(self, context, lb):
|
def refresh(self, context, lb):
|
||||||
|
Loading…
Reference in New Issue
Block a user