From b09a380f9579efc0779fb38db2cdb47b7b9e29d1 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Fri, 16 Dec 2016 22:40:50 +0000 Subject: [PATCH] Remove advertise_mtu config option It was deprecated in Newton timeframe. Now we just clean it up from the tree. DocImpact: Any advertise_mtu option notions in documentation should be removed. UpgradeImpact: After upgrade, all DHCPv4 subnets will see the MTU option served via corresponding DHCPv4 option. Also, all IPv6 subnets connected to routers will see MTU set in Router Advertisement messages. NeutronLibImpact: This patch will break any 3party plugins that directly access the configuration option. Change-Id: I31e15018fe764de0fe4d6de7da3c1d9f2cc1d532 --- neutron/agent/linux/dhcp.py | 10 ++++------ neutron/agent/linux/ra.py | 4 +--- neutron/conf/common.py | 5 ----- neutron/tests/unit/agent/l3/test_agent.py | 7 +------ neutron/tests/unit/agent/linux/test_dhcp.py | 9 +++------ neutron/tests/unit/plugins/ml2/test_plugin.py | 1 - .../notes/remove-advertise_mtu-28933264714453c4.yaml | 5 +++++ 7 files changed, 14 insertions(+), 27 deletions(-) create mode 100644 releasenotes/notes/remove-advertise_mtu-28933264714453c4.yaml diff --git a/neutron/agent/linux/dhcp.py b/neutron/agent/linux/dhcp.py index af23e0fe485..5981de25207 100644 --- a/neutron/agent/linux/dhcp.py +++ b/neutron/agent/linux/dhcp.py @@ -24,7 +24,6 @@ import netaddr from neutron_lib import constants from neutron_lib import exceptions from neutron_lib.utils import file as file_utils -from oslo_config import cfg from oslo_log import log as logging import oslo_messaging from oslo_utils import excutils @@ -389,11 +388,10 @@ class Dnsmasq(DhcpLocalProcess): cidr.prefixlen, lease)) possible_leases += cidr.size - if cfg.CONF.advertise_mtu: - mtu = getattr(self.network, 'mtu', 0) - # Do not advertise unknown mtu - if mtu > 0: - cmd.append('--dhcp-option-force=option:mtu,%d' % mtu) + mtu = getattr(self.network, 'mtu', 0) + # Do not advertise unknown mtu + if mtu > 0: + cmd.append('--dhcp-option-force=option:mtu,%d' % mtu) # Cap the limit because creating lots of subnets can inflate # this possible lease cap. diff --git a/neutron/agent/linux/ra.py b/neutron/agent/linux/ra.py index 27a70e5c964..89e9a244791 100644 --- a/neutron/agent/linux/ra.py +++ b/neutron/agent/linux/ra.py @@ -106,7 +106,6 @@ class DaemonMonitor(object): 'radvd.conf', True) buf = six.StringIO() - network_mtu = 0 for p in router_ports: subnets = p.get('subnets', []) v6_subnets = [subnet for subnet in subnets if @@ -124,8 +123,7 @@ class DaemonMonitor(object): subnet['ipv6_ra_mode'] == constants.IPV6_SLAAC] dns_servers = list(iter_chain(*[subnet['dns_nameservers'] for subnet in slaac_subnets if subnet.get('dns_nameservers')])) - if self._agent_conf.advertise_mtu: - network_mtu = p.get('mtu', 0) + network_mtu = p.get('mtu', 0) buf.write('%s' % CONFIG_TEMPLATE.render( ra_modes=list(ra_modes), diff --git a/neutron/conf/common.py b/neutron/conf/common.py index c2defefbf2b..962e7de5243 100644 --- a/neutron/conf/common.py +++ b/neutron/conf/common.py @@ -110,11 +110,6 @@ core_opts = [ cfg.IntOpt('send_events_interval', default=2, help=_('Number of seconds between sending events to nova if ' 'there are any events to send.')), - cfg.BoolOpt('advertise_mtu', default=True, - deprecated_for_removal=True, - help=_('If True, advertise network MTU values if core plugin ' - 'calculates them. MTU is advertised to running ' - 'instances via DHCP and RA MTU options.')), cfg.StrOpt('ipam_driver', default='internal', help=_("Neutron IPAM (IP address management) driver to use. " "By default, the reference implementation of the " diff --git a/neutron/tests/unit/agent/l3/test_agent.py b/neutron/tests/unit/agent/l3/test_agent.py index 7d934198289..55609f2ca62 100644 --- a/neutron/tests/unit/agent/l3/test_agent.py +++ b/neutron/tests/unit/agent/l3/test_agent.py @@ -2399,13 +2399,8 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework): ipv6_subnet_modes, None, network_mtu) + # Verify that MTU is advertised expected = "AdvLinkMTU 1446" - ri.agent_conf.set_override('advertise_mtu', False) - ri.radvd._generate_radvd_conf(router[lib_constants.INTERFACE_KEY]) - self.assertNotIn(expected, self.utils_replace_file.call_args[0][1]) - - # Verify that MTU is advertised when advertise_mtu is True - ri.agent_conf.set_override('advertise_mtu', True) ri.radvd._generate_radvd_conf(router[lib_constants.INTERFACE_KEY]) self.assertIn(expected, self.utils_replace_file.call_args[0][1]) diff --git a/neutron/tests/unit/agent/linux/test_dhcp.py b/neutron/tests/unit/agent/linux/test_dhcp.py index 743a7f312fc..20f8f68da5d 100644 --- a/neutron/tests/unit/agent/linux/test_dhcp.py +++ b/neutron/tests/unit/agent/linux/test_dhcp.py @@ -1127,10 +1127,9 @@ class TestDnsmasq(TestBase): lease_duration, seconds)]) possible_leases += netaddr.IPNetwork(s.cidr).size - if cfg.CONF.advertise_mtu: - if hasattr(network, 'mtu'): - expected.append( - '--dhcp-option-force=option:mtu,%s' % network.mtu) + if hasattr(network, 'mtu'): + expected.append( + '--dhcp-option-force=option:mtu,%s' % network.mtu) expected.append('--dhcp-lease-max=%d' % min( possible_leases, max_leases)) @@ -1255,14 +1254,12 @@ class TestDnsmasq(TestBase): '--dhcp-broadcast']) def test_spawn_cfg_advertise_mtu(self): - cfg.CONF.set_override('advertise_mtu', True) network = FakeV4Network() network.mtu = 1500 self._test_spawn(['--conf-file=', '--domain=openstacklocal'], network) def test_spawn_cfg_advertise_mtu_plugin_doesnt_pass_mtu_value(self): - cfg.CONF.set_override('advertise_mtu', True) network = FakeV4Network() self._test_spawn(['--conf-file=', '--domain=openstacklocal'], network) diff --git a/neutron/tests/unit/plugins/ml2/test_plugin.py b/neutron/tests/unit/plugins/ml2/test_plugin.py index cbedfcdb849..730fa8cc729 100644 --- a/neutron/tests/unit/plugins/ml2/test_plugin.py +++ b/neutron/tests/unit/plugins/ml2/test_plugin.py @@ -485,7 +485,6 @@ class TestMl2NetworksWithVlanTransparencyAndMTU( return_value=True): config.cfg.CONF.set_override('path_mtu', 1000, group='ml2') config.cfg.CONF.set_override('global_physnet_mtu', 1000) - config.cfg.CONF.set_override('advertise_mtu', True) network_req = self.new_create_request('networks', self.data) res = network_req.get_response(self.api) self.assertEqual(201, res.status_int) diff --git a/releasenotes/notes/remove-advertise_mtu-28933264714453c4.yaml b/releasenotes/notes/remove-advertise_mtu-28933264714453c4.yaml new file mode 100644 index 00000000000..8985f3fd501 --- /dev/null +++ b/releasenotes/notes/remove-advertise_mtu-28933264714453c4.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - The ``advertise_mtu`` option is removed. Now Neutron always uses all + available means to advertise MTUs to instances (including DHCPv4 and IPv6 + RA).