# 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
# 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
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 "
'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 '
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):
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)
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,
'-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)
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()
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: