Merge "NSXT LBaaS: Fail HM delete operation on exception"

This commit is contained in:
Zuul 2019-02-14 08:01:51 +00:00 committed by Gerrit Code Review
commit f48ac943ae

View File

@ -145,19 +145,27 @@ class EdgeHealthMonitorManagerFromDict(base_mgr.Nsxv3LoadbalancerBaseManager):
try:
pool_client.remove_monitor_from_pool(lb_pool_id,
lb_monitor_id)
except nsxlib_exc.ResourceNotFound:
pass
except nsxlib_exc.ManagerError as exc:
LOG.error('Failed to remove monitor %(monitor)s from pool '
'%(pool)s with exception from nsx %(exc)s)',
{'monitor': lb_monitor_id,
'pool': lb_pool_id,
'exc': exc})
completor(success=False)
msg = _('Failed to remove monitor %(monitor)s from pool '
'%(pool)s with exception from nsx %(exc)s)') % {
'monitor': lb_monitor_id,
'pool': lb_pool_id,
'exc': exc}
raise n_exc.BadRequest(resource='lbaas-hm', msg=msg)
try:
monitor_client.delete(lb_monitor_id)
except nsxlib_exc.ResourceNotFound:
pass
except nsxlib_exc.ManagerError as exc:
LOG.error('Failed to delete monitor %(monitor)s from '
'backend with exception %(exc)s',
{'monitor': lb_monitor_id,
'exc': exc})
completor(success=False)
msg = _('Failed to delete monitor %(monitor)s from '
'backend with exception %(exc)s') % {
'monitor': lb_monitor_id,
'exc': exc}
raise n_exc.BadRequest(resource='lbaas-hm', msg=msg)
nsx_db.delete_nsx_lbaas_monitor_binding(context.session, lb_id,
pool_id, hm['id'])