diff --git a/neutron/agent/l3_agent.py b/neutron/agent/l3_agent.py index 991c378857..34f6fbabd5 100644 --- a/neutron/agent/l3_agent.py +++ b/neutron/agent/l3_agent.py @@ -215,8 +215,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback, manager.Manager): self.removed_routers = set() self.sync_progress = False - self._delete_stale_namespaces = (self.conf.use_namespaces and - self.conf.router_delete_namespaces) + self._clean_stale_namespaces = self.conf.use_namespaces self.rpc_loop = loopingcall.FixedIntervalLoopingCall( self._rpc_loop) @@ -244,7 +243,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback, manager.Manager): def _cleanup_namespaces(self, routers): """Destroy stale router namespaces on host when L3 agent restarts - This routine is called when self._delete_stale_namespaces is True. + This routine is called when self._clean_stale_namespaces is True. The argument routers is the list of routers that are recorded in the database as being hosted on this node. @@ -280,7 +279,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback, manager.Manager): except RuntimeError: LOG.exception(_('Failed to destroy stale router namespace ' '%s'), ns) - self._delete_stale_namespaces = False + self._clean_stale_namespaces = False def _destroy_router_namespace(self, namespace): ns_ip = ip_lib.IPWrapper(self.root_helper, namespace=namespace) @@ -860,7 +859,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback, manager.Manager): # Resync is not necessary for the cleanup of stale # namespaces. - if self._delete_stale_namespaces: + if self._clean_stale_namespaces: self._cleanup_namespaces(routers) def after_start(self): diff --git a/neutron/tests/unit/test_l3_agent.py b/neutron/tests/unit/test_l3_agent.py index d1dffffb4c..8f936d4bcc 100644 --- a/neutron/tests/unit/test_l3_agent.py +++ b/neutron/tests/unit/test_l3_agent.py @@ -998,7 +998,7 @@ class TestBasicRouterOperations(base.BaseTestCase): self.conf.set_override('router_id', '1234') agent = l3_agent.L3NATAgent(HOSTNAME, self.conf) self.assertEqual(['1234'], agent._router_ids()) - self.assertFalse(agent._delete_stale_namespaces) + self.assertFalse(agent._clean_stale_namespaces) def test_process_routers_with_no_ext_net_in_conf(self): agent = l3_agent.L3NATAgent(HOSTNAME, self.conf) @@ -1144,7 +1144,7 @@ class TestBasicRouterOperations(base.BaseTestCase): agent = l3_agent.L3NATAgent(HOSTNAME, self.conf) - self.assertTrue(agent._delete_stale_namespaces) + self.assertTrue(agent._clean_stale_namespaces) pm = self.external_process.return_value pm.reset_mock() @@ -1158,7 +1158,7 @@ class TestBasicRouterOperations(base.BaseTestCase): expected_args = [mock.call(ns) for ns in stale_namespace_list] agent._destroy_router_namespace.assert_has_calls(expected_args, any_order=True) - self.assertFalse(agent._delete_stale_namespaces) + self.assertFalse(agent._clean_stale_namespaces) def test_cleanup_namespace(self): self.conf.set_override('router_id', None)