From: Eugene Nikanorov Date: Wed, 22 Apr 2015 15:45:57 +0000 (+0400) Subject: Finally let L3 and DHCP agents cleanup namespaces by default X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=723162501a5e2e5f202af9d95a1b946e3d43cf96;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/etc/dhcp_agent.ini b/etc/dhcp_agent.ini index 5b6c58ba1..a0adccaaa 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 05f416cef..0d56436bf 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 b8bb8c136..0cf60aa1f 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 46b248c2a..98cfa3a88 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 6c25c9655..0936a3390 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 629053b52..127dfcc17 --- 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 bdf62fbbd..058452ce9 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 fca35c1bb..b9f349942 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: