]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove deprecated namespace deletion options
authorCedric Brandily <zzelle@gmail.com>
Tue, 20 Oct 2015 21:03:39 +0000 (23:03 +0200)
committerCedric Brandily <zzelle@gmail.com>
Wed, 21 Oct 2015 10:53:14 +0000 (12:53 +0200)
dhcp/router_delete_namespaces[1] options have been defined as a
workaround to an iproute2 limitation[1] corrected 2 years ago.

That's why the change removes these options after their deprecation
in Liberty.

[1] in neutron.agent.dhcp/l3.config

DocImpact
Closes-Bug: #1508189
Related-Bug: #1418079
Change-Id: I2a879213c3b095a007a4531f430a33cea9fdf1bd

etc/dhcp_agent.ini
etc/l3_agent.ini
neutron/agent/dhcp/config.py
neutron/agent/l3/config.py
neutron/agent/l3/namespaces.py
neutron/agent/linux/dhcp.py
neutron/tests/functional/agent/l3/test_namespace_manager.py
neutron/tests/unit/agent/l3/test_agent.py
neutron/tests/unit/agent/l3/test_dvr_fip_ns.py
neutron/tests/unit/agent/linux/test_dhcp.py

index 40c6c47e50264c6f015ae4b04df61cd3d69a94cb..a7e5547ba31e082675597e9f92ad6e2c5082e059 100644 (file)
 # Use broadcast in DHCP replies
 # dhcp_broadcast_reply = 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.
-# This should not be a problem any more.  Refer to bug:
-# https://bugs.launchpad.net/neutron/+bug/1418079
-# This option is deprecated and will be removed in the M release
-# dhcp_delete_namespaces = True
-
 # Timeout for ovs-vsctl commands.
 # If the timeout expires, ovs commands will fail with ALARMCLOCK error.
 # ovs_vsctl_timeout = 10
index a0c9de71e6c59ddfd16cf45408ac851e1f802960..ce740a1b9d3262162ab228cbb2d6075bfafbecc6 100644 (file)
 # Iptables mangle mark used to mark ingress from external network
 # external_ingress_mark = 0x2
 
-# 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.
-# This should not be a problem any more.  Refer to bug:
-# https://bugs.launchpad.net/neutron/+bug/1418079
-# This option is deprecated and will be removed in the M release
-# router_delete_namespaces = True
-
 # Timeout for ovs-vsctl commands.
 # If the timeout expires, ovs commands will fail with ALARMCLOCK error.
 # ovs_vsctl_timeout = 10
index 1ff185d83f1fc859a66d47175503bdc4fe38c995..a6c00b9e17fb2a7eaf3e85ca2590070ee4ee59fa 100644 (file)
@@ -55,11 +55,6 @@ 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=True,
-                help=_("Delete namespace after removing a dhcp server."
-                       "This option is deprecated and "
-                       "will be removed in a future release."),
-                deprecated_for_removal=True),
     cfg.StrOpt('dnsmasq_base_log_dir',
                help=_("Base log dir for dnsmasq logging. "
                       "The log contains DHCP and DNS log information and "
index ce0def6453bfa706dca5c9d85e888e224c7cd540..73e552a1a70f4bd9628aeb3c6e71ad155dc7cf96 100644 (file)
@@ -85,11 +85,6 @@ OPTS = [
                       'source.')),
     cfg.BoolOpt('enable_metadata_proxy', default=True,
                 help=_("Allow running metadata proxy.")),
-    cfg.BoolOpt('router_delete_namespaces', default=True,
-                help=_("Delete namespace after removing a router."
-                       "This option is deprecated and "
-                       "will be removed in a future release."),
-                deprecated_for_removal=True),
     cfg.StrOpt('metadata_access_mark',
                default='0x1',
                help=_('Iptables mangle mark used to mark metadata valid '
index 1f85fc149d3cbfa85e7016c1d2d7fa34f9e84b7f..e3c6973d7f6609d56f31574062c9307a21700f53 100644 (file)
@@ -76,12 +76,11 @@ class Namespace(object):
             ip_wrapper.netns.execute(cmd)
 
     def delete(self):
-        if self.agent_conf.router_delete_namespaces:
-            try:
-                self.ip_wrapper_root.netns.delete(self.name)
-            except RuntimeError:
-                msg = _LE('Failed trying to delete namespace: %s')
-                LOG.exception(msg, self.name)
+        try:
+            self.ip_wrapper_root.netns.delete(self.name)
+        except RuntimeError:
+            msg = _LE('Failed trying to delete namespace: %s')
+            LOG.exception(msg, self.name)
 
 
 class RouterNamespace(Namespace):
index 2f3c87b6dd1be4dd20eaa0d10dbcb5c50b081f01..7c67f18d6d4efbd227996d84bc5117abe57b5b26 100644 (file)
@@ -228,7 +228,7 @@ class DhcpLocalProcess(DhcpBase):
             LOG.warning(_LW('Failed trying to delete interface: %s'),
                         self.interface_name)
 
-        if self.conf.dhcp_delete_namespaces and self.network.namespace:
+        if self.network.namespace:
             ns_ip = ip_lib.IPWrapper(namespace=self.network.namespace)
             try:
                 ns_ip.netns.delete(self.network.namespace)
index 9b58cae7804b6762abb46b01bc9e5978f414cea8..6f070c2ab27e269c050a370b2bd16077d59d8f89 100644 (file)
@@ -30,7 +30,6 @@ class NamespaceManagerTestFramework(base.BaseSudoTestCase):
     def setUp(self):
         super(NamespaceManagerTestFramework, self).setUp()
         self.agent_conf = mock.MagicMock()
-        self.agent_conf.router_delete_namespaces = True
         self.metadata_driver_mock = mock.Mock()
         self.namespace_manager = namespace_manager.NamespaceManager(
             self.agent_conf, driver=None, clean_stale=True,
index d16a7c4c8ea38714af5d7ac365dfacc321bb53fc..fa8730af71a041769ecd2d226ecc3e1475a2c95b 100644 (file)
@@ -1718,16 +1718,7 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
                                                         '-bar')
         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)
-        ns.create()
-        ns.delete()
-        self.assertEqual(0, self.mock_ip.netns.delete.call_count)
-
-    def test_destroy_router_namespace_removes_ns(self):
+    def test_destroy_router_namespace(self):
         agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
         ns = namespaces.Namespace(
             'qrouter-bar', self.conf, agent.driver, agent.use_ipv6)
index a87aa31243d6fed63298bc35d3c40bb57a59c24a..49936f165bc212b45b7d24a0ae75e520b396f98b 100644 (file)
@@ -103,9 +103,10 @@ class TestDvrFipNs(base.BaseTestCase):
         dev2.name = 'fg-aaaa'
         ip_wrapper.get_devices.return_value = [dev1, dev2]
 
-        self.conf.router_delete_namespaces = False
-
-        self.fip_ns.delete()
+        with mock.patch.object(self.fip_ns.ip_wrapper_root.netns,
+                               'delete') as delete:
+            self.fip_ns.delete()
+            delete.assert_called_once_with(mock.ANY)
 
         ext_net_bridge = self.conf.external_network_bridge
         ns_name = self.fip_ns.get_name()
index 3f29ca60c38dc37184374a740ff2c9b9874fb402..ac264c308189cfcab359b8f2abde9df5b96c70b5 100644 (file)
@@ -942,25 +942,6 @@ 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()
-        with mock.patch.multiple(LocalChild, **attrs_to_mock) as mocks:
-            mocks['active'].__get__ = mock.Mock(return_value=True)
-            mocks['interface_name'].__get__ = mock.Mock(return_value='tap0')
-            lp = LocalChild(self.conf, network)
-            with mock.patch('neutron.agent.linux.ip_lib.IPWrapper') as ip:
-                lp.disable()
-
-            self._assert_disabled(lp)
-
-        self.mock_mgr.assert_has_calls([mock.call(self.conf, None),
-                                        mock.call().destroy(network, 'tap0')])
-
-        self.assertEqual(ip.return_value.netns.delete.call_count, 0)
-
-    def test_disable_delete_ns(self):
         attrs_to_mock = {'active': mock.DEFAULT}
 
         with mock.patch.multiple(LocalChild, **attrs_to_mock) as mocks: