diff --git a/nova/conf/network.py b/nova/conf/network.py index dc12cfcd4656..60abeffcd9e6 100644 --- a/nova/conf/network.py +++ b/nova/conf/network.py @@ -381,20 +381,6 @@ The use of this configuration has been deprecated and may be removed in any release after Mitaka. It is recommended that instead of relying on this option, an explicit value should be passed to 'create_networks()' as a keyword argument with the name 'share_address'. -"""), - - # NOTE(mriedem): Remove network_device_mtu in Newton. - cfg.IntOpt("network_device_mtu", - deprecated_for_removal=True, - help=""" -THIS VALUE SHOULD BE SET WHEN CREATING THE NETWORK. - -MTU (Maximum Transmission Unit) setting for a network interface. - -The use of this configuration has been deprecated and may be removed in any -release after Mitaka. It is recommended that instead of relying on this option, -an explicit value should be passed to 'create_networks()' as a keyword argument -with the name 'mtu'. """), cfg.BoolOpt('use_neutron', default=False, diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index f96a3bb7c40c..b10fa287df65 100644 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -1231,9 +1231,6 @@ def _ip_bridge_cmd(action, params, device): def _set_device_mtu(dev, mtu=None): """Set the device MTU.""" - - if not mtu: - mtu = CONF.network_device_mtu if mtu: utils.execute('ip', 'link', 'set', dev, 'mtu', mtu, run_as_root=True, diff --git a/nova/network/manager.py b/nova/network/manager.py index d395cd5c49f8..b21a5960cfe0 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -1111,8 +1111,6 @@ class NetworkManager(manager.Manager): bridge_interface=None, dns1=None, dns2=None, fixed_cidr=None, allowed_start=None, allowed_end=None, **kwargs): - if 'mtu' not in kwargs: - kwargs['mtu'] = CONF.network_device_mtu if 'dhcp_server' not in kwargs: kwargs['dhcp_server'] = gateway if 'enable_dhcp' not in kwargs: diff --git a/nova/objects/network.py b/nova/objects/network.py index e4319eab541f..729c2aa69dc4 100644 --- a/nova/objects/network.py +++ b/nova/objects/network.py @@ -105,8 +105,6 @@ class Network(obj_base.NovaPersistentObject, obj_base.NovaObject, db_value = db_network[field] if field is 'netmask_v6' and db_value is not None: db_value = network._convert_legacy_ipv6_netmask(db_value) - if field is 'mtu' and db_value is None: - db_value = CONF.network_device_mtu if field is 'dhcp_server' and db_value is None: db_value = db_network['gateway'] if field is 'share_address' and CONF.share_dhcp_address: diff --git a/nova/tests/unit/network/test_linux_net.py b/nova/tests/unit/network/test_linux_net.py index 97b71ca4ac38..4b90da50f62d 100644 --- a/nova/tests/unit/network/test_linux_net.py +++ b/nova/tests/unit/network/test_linux_net.py @@ -1199,17 +1199,6 @@ class LinuxNetworkTestCase(test.NoDBTestCase): driver.ensure_bridge('brq1234567-89', '') device_exists.assert_called_once_with('brq1234567-89') - def test_set_device_mtu_configured(self): - self.flags(network_device_mtu=10000) - calls = [ - mock.call('ip', 'link', 'set', 'fake-dev', 'mtu', - 10000, run_as_root=True, - check_exit_code=[0, 2, 254]) - ] - with mock.patch.object(utils, 'execute', return_value=('', '')) as ex: - linux_net._set_device_mtu('fake-dev') - ex.assert_has_calls(calls) - def test_set_device_mtu_default(self): calls = [] with mock.patch.object(utils, 'execute', return_value=('', '')) as ex: @@ -1277,24 +1266,6 @@ class LinuxNetworkTestCase(test.NoDBTestCase): self.assertFalse(mock_set_device_mtu.called) self.assertTrue(mock_vsctl.called) - def test_ovs_vif_port_with_mtu(self): - self.flags(network_device_mtu=10000) - calls = [ - mock.call('ovs-vsctl', '--timeout=120', '--', '--if-exists', - 'del-port', 'fake-dev', '--', 'add-port', - 'fake-bridge', 'fake-dev', - '--', 'set', 'Interface', 'fake-dev', - 'external-ids:iface-id=fake-iface-id', - 'external-ids:iface-status=active', - 'external-ids:attached-mac=fake-mac', - 'external-ids:vm-uuid=fake-instance-uuid', - run_as_root=True), - mock.call('ip', 'link', 'set', 'fake-dev', 'mtu', - 10000, run_as_root=True, - check_exit_code=[0, 2, 254]) - ] - self._ovs_vif_port(calls) - def _create_veth_pair(self, calls): with mock.patch.object(utils, 'execute', return_value=('', '')) as ex: linux_net._create_veth_pair('fake-dev1', 'fake-dev2') @@ -1315,28 +1286,6 @@ class LinuxNetworkTestCase(test.NoDBTestCase): ] self._create_veth_pair(calls) - def test_create_veth_pair_with_mtu(self): - self.flags(network_device_mtu=10000) - calls = [ - mock.call('ip', 'link', 'add', 'fake-dev1', 'type', 'veth', - 'peer', 'name', 'fake-dev2', run_as_root=True), - mock.call('ip', 'link', 'set', 'fake-dev1', 'up', - run_as_root=True), - mock.call('ip', 'link', 'set', 'fake-dev1', 'promisc', 'on', - run_as_root=True), - mock.call('ip', 'link', 'set', 'fake-dev1', 'mtu', - 10000, run_as_root=True, - check_exit_code=[0, 2, 254]), - mock.call('ip', 'link', 'set', 'fake-dev2', 'up', - run_as_root=True), - mock.call('ip', 'link', 'set', 'fake-dev2', 'promisc', 'on', - run_as_root=True), - mock.call('ip', 'link', 'set', 'fake-dev2', 'mtu', - 10000, run_as_root=True, - check_exit_code=[0, 2, 254]) - ] - self._create_veth_pair(calls) - def test_exec_ebtables_success(self): executes = [] diff --git a/releasenotes/notes/remove_config_network_device_mtu-75780f727c322ff3.yaml b/releasenotes/notes/remove_config_network_device_mtu-75780f727c322ff3.yaml new file mode 100644 index 000000000000..3deded47bd51 --- /dev/null +++ b/releasenotes/notes/remove_config_network_device_mtu-75780f727c322ff3.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - The network_device_mtu option in Nova is deprecated for removal + in 13.0.0 since network MTU should be specified when creating + the network.