Merge "Delete routers that are requested but not reported as active"
This commit is contained in:
@@ -770,9 +770,6 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback, manager.Manager):
|
|||||||
[router['id'] for router in routers])
|
[router['id'] for router in routers])
|
||||||
cur_router_ids = set()
|
cur_router_ids = set()
|
||||||
for r in routers:
|
for r in routers:
|
||||||
if not r['admin_state_up']:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# If namespaces are disabled, only process the router associated
|
# If namespaces are disabled, only process the router associated
|
||||||
# with the configured agent id.
|
# with the configured agent id.
|
||||||
if (not self.conf.use_namespaces and
|
if (not self.conf.use_namespaces and
|
||||||
@@ -809,9 +806,13 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback, manager.Manager):
|
|||||||
len(self.updated_routers))
|
len(self.updated_routers))
|
||||||
if self.updated_routers:
|
if self.updated_routers:
|
||||||
router_ids = list(self.updated_routers)
|
router_ids = list(self.updated_routers)
|
||||||
self.updated_routers.clear()
|
|
||||||
routers = self.plugin_rpc.get_routers(
|
routers = self.plugin_rpc.get_routers(
|
||||||
self.context, router_ids)
|
self.context, router_ids)
|
||||||
|
|
||||||
|
fetched = set([r['id'] for r in routers])
|
||||||
|
self.removed_routers.update(self.updated_routers - fetched)
|
||||||
|
self.updated_routers.clear()
|
||||||
|
|
||||||
self._process_routers(routers)
|
self._process_routers(routers)
|
||||||
self._process_router_delete()
|
self._process_router_delete()
|
||||||
LOG.debug(_("RPC loop successfully completed"))
|
LOG.debug(_("RPC loop successfully completed"))
|
||||||
|
|||||||
@@ -895,17 +895,6 @@ class TestBasicRouterOperations(base.BaseTestCase):
|
|||||||
namespace=ri.ns_name,
|
namespace=ri.ns_name,
|
||||||
prefix=l3_agent.EXTERNAL_DEV_PREFIX)
|
prefix=l3_agent.EXTERNAL_DEV_PREFIX)
|
||||||
|
|
||||||
def test_routers_with_admin_state_down(self):
|
|
||||||
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
|
||||||
self.plugin_api.get_external_network_id.return_value = None
|
|
||||||
|
|
||||||
routers = [
|
|
||||||
{'id': _uuid(),
|
|
||||||
'admin_state_up': False,
|
|
||||||
'external_gateway_info': {}}]
|
|
||||||
agent._process_routers(routers)
|
|
||||||
self.assertNotIn(routers[0]['id'], agent.router_info)
|
|
||||||
|
|
||||||
def test_router_deleted(self):
|
def test_router_deleted(self):
|
||||||
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
||||||
agent.router_deleted(None, FAKE_ID)
|
agent.router_deleted(None, FAKE_ID)
|
||||||
|
|||||||
Reference in New Issue
Block a user