From 723162501a5e2e5f202af9d95a1b946e3d43cf96 Mon Sep 17 00:00:00 2001 From: Eugene Nikanorov Date: Wed, 22 Apr 2015 19:45:57 +0400 Subject: [PATCH] Finally let L3 and DHCP agents cleanup namespaces by default There has been a problem with iproute package that resulted in errors when deleting the namespaces, so deleting was turned off by default. According to tests with iproute version 3.12.0 there is no such issue so the option could be safely turned on by default. DocImpact Related-Bug: #1052535 Related-Bug: #1402739 Change-Id: I4c831f98fb2462382ef0f9216e265555186b965a --- etc/dhcp_agent.ini | 13 ++++++------- etc/l3_agent.ini | 12 ++++++------ neutron/agent/dhcp/config.py | 2 +- neutron/agent/l3/config.py | 2 +- neutron/tests/fullstack/config_fixtures.py | 1 - neutron/tests/functional/agent/test_l3_agent.py | 1 - neutron/tests/unit/agent/l3/test_agent.py | 4 +--- neutron/tests/unit/agent/linux/test_dhcp.py | 2 +- 8 files changed, 16 insertions(+), 21 deletions(-) mode change 100755 => 100644 neutron/tests/functional/agent/test_l3_agent.py diff --git a/etc/dhcp_agent.ini b/etc/dhcp_agent.ini index 5b6c58ba1c0..a0adccaaae6 100644 --- a/etc/dhcp_agent.ini +++ b/etc/dhcp_agent.ini @@ -77,13 +77,12 @@ # Use broadcast in DHCP replies # dhcp_broadcast_reply = False -# dhcp_delete_namespaces, which is false by default, can be set to True if -# namespaces can be deleted cleanly on the host running the dhcp agent. -# Do not enable this until you understand the problem with the Linux iproute -# utility mentioned in https://bugs.launchpad.net/neutron/+bug/1052535 and -# you are sure that your version of iproute does not suffer from the problem. -# If True, namespaces will be deleted when a dhcp server is disabled. -# dhcp_delete_namespaces = False +# dhcp_delete_namespaces, which is True by default, can be set to False if +# namespaces can't be deleted cleanly on the host running the DHCP agent. +# Disable this if you hit the issue in +# https://bugs.launchpad.net/neutron/+bug/1052535 or if +# you are sure that your version of iproute suffers from the problem. +# dhcp_delete_namespaces = True # Timeout for ovs-vsctl commands. # If the timeout expires, ovs commands will fail with ALARMCLOCK error. diff --git a/etc/l3_agent.ini b/etc/l3_agent.ini index 05f416cef67..0d56436bf8e 100644 --- a/etc/l3_agent.ini +++ b/etc/l3_agent.ini @@ -85,13 +85,13 @@ # Iptables mangle mark used to mark ingress from external network # external_ingress_mark = 0x2 -# router_delete_namespaces, which is false by default, can be set to True if -# namespaces can be deleted cleanly on the host running the L3 agent. -# Do not enable this until you understand the problem with the Linux iproute -# utility mentioned in https://bugs.launchpad.net/neutron/+bug/1052535 and -# you are sure that your version of iproute does not suffer from the problem. +# router_delete_namespaces, which is True by default, can be set to False if +# namespaces can't be deleted cleanly on the host running the L3 agent. +# Disable this if you hit the issue in +# https://bugs.launchpad.net/neutron/+bug/1052535 or if +# you are sure that your version of iproute suffers from the problem. # If True, namespaces will be deleted when a router is destroyed. -# router_delete_namespaces = False +# router_delete_namespaces = True # Timeout for ovs-vsctl commands. # If the timeout expires, ovs commands will fail with ALARMCLOCK error. diff --git a/neutron/agent/dhcp/config.py b/neutron/agent/dhcp/config.py index b8bb8c13649..0cf60aa1f71 100644 --- a/neutron/agent/dhcp/config.py +++ b/neutron/agent/dhcp/config.py @@ -49,7 +49,7 @@ DNSMASQ_OPTS = [ help=_('Comma-separated list of the DNS servers which will be ' 'used as forwarders.'), deprecated_name='dnsmasq_dns_server'), - cfg.BoolOpt('dhcp_delete_namespaces', default=False, + cfg.BoolOpt('dhcp_delete_namespaces', default=True, help=_("Delete namespace after removing a dhcp server.")), cfg.IntOpt( 'dnsmasq_lease_max', diff --git a/neutron/agent/l3/config.py b/neutron/agent/l3/config.py index 46b248c2af6..98cfa3a88fc 100644 --- a/neutron/agent/l3/config.py +++ b/neutron/agent/l3/config.py @@ -76,7 +76,7 @@ OPTS = [ "to the network and not through this parameter. ")), cfg.BoolOpt('enable_metadata_proxy', default=True, help=_("Allow running metadata proxy.")), - cfg.BoolOpt('router_delete_namespaces', default=False, + cfg.BoolOpt('router_delete_namespaces', default=True, help=_("Delete namespace after removing a router.")), cfg.StrOpt('metadata_access_mark', default='0x1', diff --git a/neutron/tests/fullstack/config_fixtures.py b/neutron/tests/fullstack/config_fixtures.py index 6c25c965507..0936a3390f1 100644 --- a/neutron/tests/fullstack/config_fixtures.py +++ b/neutron/tests/fullstack/config_fixtures.py @@ -204,7 +204,6 @@ class L3ConfigFixture(ConfigFixture): 'OVSInterfaceDriver'), 'ovs_integration_bridge': integration_bridge, 'external_network_bridge': self._generate_external_bridge(), - 'router_delete_namespaces': 'True', 'debug': 'True', 'verbose': 'True', } diff --git a/neutron/tests/functional/agent/test_l3_agent.py b/neutron/tests/functional/agent/test_l3_agent.py old mode 100755 new mode 100644 index 629053b52b7..127dfcc17f6 --- a/neutron/tests/functional/agent/test_l3_agent.py +++ b/neutron/tests/functional/agent/test_l3_agent.py @@ -83,7 +83,6 @@ class L3AgentTestFramework(base.BaseSudoTestCase): conf.set_override( 'interface_driver', 'neutron.agent.linux.interface.OVSInterfaceDriver') - conf.set_override('router_delete_namespaces', True) br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge br_ex = self.useFixture(net_helpers.OVSBridgeFixture()).bridge diff --git a/neutron/tests/unit/agent/l3/test_agent.py b/neutron/tests/unit/agent/l3/test_agent.py index bdf62fbbd99..058452ce9a8 100644 --- a/neutron/tests/unit/agent/l3/test_agent.py +++ b/neutron/tests/unit/agent/l3/test_agent.py @@ -1941,6 +1941,7 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework): self.mock_ip.del_veth.assert_called_once_with('rfp-aaaa') def test_destroy_router_namespace_skips_ns_removal(self): + self.conf.set_override('router_delete_namespaces', False) agent = l3_agent.L3NATAgent(HOSTNAME, self.conf) ns = namespaces.Namespace( 'qrouter-bar', self.conf, agent.driver, agent.use_ipv6) @@ -1949,7 +1950,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework): self.assertEqual(self.mock_ip.netns.delete.call_count, 0) def test_destroy_router_namespace_removes_ns(self): - self.conf.set_override('router_delete_namespaces', True) agent = l3_agent.L3NATAgent(HOSTNAME, self.conf) ns = namespaces.Namespace( 'qrouter-bar', self.conf, agent.driver, agent.use_ipv6) @@ -2149,7 +2149,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework): other_namespaces, mock_snat_ns, mock_router_ns): - self.conf.set_override('router_delete_namespaces', True) good_namespace_list = [namespaces.NS_PREFIX + r['id'] for r in router_list] @@ -2281,7 +2280,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework): def _test_external_gateway_removed_ext_gw_port_and_fip(self, fip_ns=False): self.conf.set_override('state_path', '/tmp') - self.conf.set_override('router_delete_namespaces', True) agent = l3_agent.L3NATAgent(HOSTNAME, self.conf) agent.conf.agent_mode = 'dvr_snat' diff --git a/neutron/tests/unit/agent/linux/test_dhcp.py b/neutron/tests/unit/agent/linux/test_dhcp.py index fca35c1bb8b..b9f349942a0 100644 --- a/neutron/tests/unit/agent/linux/test_dhcp.py +++ b/neutron/tests/unit/agent/linux/test_dhcp.py @@ -742,6 +742,7 @@ class TestDhcpLocalProcess(TestBase): self._assert_disabled(lp) def test_disable(self): + self.conf.set_override('dhcp_delete_namespaces', False) attrs_to_mock = dict([(a, mock.DEFAULT) for a in ['active', 'interface_name']]) network = FakeDualNetwork() @@ -760,7 +761,6 @@ class TestDhcpLocalProcess(TestBase): self.assertEqual(ip.return_value.netns.delete.call_count, 0) def test_disable_delete_ns(self): - self.conf.set_override('dhcp_delete_namespaces', True) attrs_to_mock = {'active': mock.DEFAULT} with mock.patch.multiple(LocalChild, **attrs_to_mock) as mocks: