Merge "Make HA deletion attempt on RouterNotFound race"
This commit is contained in:
commit
1245b3c4a0
neutron
@ -306,6 +306,12 @@ class L3Scheduler(object):
|
||||
except l3.RouterNotFound:
|
||||
LOG.debug('Router %s has already been removed '
|
||||
'by concurrent operation', router_id)
|
||||
# we try to clear the HA network here in case the port we created
|
||||
# blocked the concurrent router delete operation from getting rid
|
||||
# of the HA network
|
||||
ha_net = plugin.get_ha_network(ctxt, tenant_id)
|
||||
if ha_net:
|
||||
plugin.safe_delete_ha_network(ctxt, ha_net, tenant_id)
|
||||
|
||||
def get_ha_routers_l3_agents_counts(self, plugin, context, filters=None):
|
||||
"""Return a mapping (router, # agents) matching specified filters."""
|
||||
|
@ -1397,10 +1397,13 @@ class L3HATestCaseMixin(testlib_api.SqlTestCase,
|
||||
with mock.patch.object(self.plugin.router_scheduler, 'bind_router'):
|
||||
with mock.patch.object(
|
||||
self.plugin, 'add_ha_port',
|
||||
side_effect=l3.RouterNotFound(router_id='foo_router')):
|
||||
side_effect=l3.RouterNotFound(router_id='foo_router')),\
|
||||
mock.patch.object(
|
||||
self.plugin, 'safe_delete_ha_network') as sd_ha_net:
|
||||
self.plugin.router_scheduler.create_ha_port_and_bind(
|
||||
self.plugin, self.adminContext,
|
||||
router['id'], router['tenant_id'], agent)
|
||||
self.assertTrue(sd_ha_net.called)
|
||||
|
||||
def test_create_ha_port_and_bind_bind_router_returns_None(self):
|
||||
router = self._create_ha_router(tenant_id='foo_tenant')
|
||||
|
Loading…
x
Reference in New Issue
Block a user