Merge "Remove deprecated configuration option network_device_mtu"

This commit is contained in:
Jenkins 2016-09-14 16:51:54 +00:00 committed by Gerrit Code Review
commit ce0fbe4eb1
6 changed files with 5 additions and 72 deletions

View File

@ -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, 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 an explicit value should be passed to 'create_networks()' as a keyword argument
with the name 'share_address'. 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', cfg.BoolOpt('use_neutron',
default=False, default=False,

View File

@ -1231,9 +1231,6 @@ def _ip_bridge_cmd(action, params, device):
def _set_device_mtu(dev, mtu=None): def _set_device_mtu(dev, mtu=None):
"""Set the device MTU.""" """Set the device MTU."""
if not mtu:
mtu = CONF.network_device_mtu
if mtu: if mtu:
utils.execute('ip', 'link', 'set', dev, 'mtu', utils.execute('ip', 'link', 'set', dev, 'mtu',
mtu, run_as_root=True, mtu, run_as_root=True,

View File

@ -1111,8 +1111,6 @@ class NetworkManager(manager.Manager):
bridge_interface=None, dns1=None, dns2=None, bridge_interface=None, dns1=None, dns2=None,
fixed_cidr=None, allowed_start=None, fixed_cidr=None, allowed_start=None,
allowed_end=None, **kwargs): allowed_end=None, **kwargs):
if 'mtu' not in kwargs:
kwargs['mtu'] = CONF.network_device_mtu
if 'dhcp_server' not in kwargs: if 'dhcp_server' not in kwargs:
kwargs['dhcp_server'] = gateway kwargs['dhcp_server'] = gateway
if 'enable_dhcp' not in kwargs: if 'enable_dhcp' not in kwargs:

View File

@ -105,8 +105,6 @@ class Network(obj_base.NovaPersistentObject, obj_base.NovaObject,
db_value = db_network[field] db_value = db_network[field]
if field is 'netmask_v6' and db_value is not None: if field is 'netmask_v6' and db_value is not None:
db_value = network._convert_legacy_ipv6_netmask(db_value) 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: if field is 'dhcp_server' and db_value is None:
db_value = db_network['gateway'] db_value = db_network['gateway']
if field is 'share_address' and CONF.share_dhcp_address: if field is 'share_address' and CONF.share_dhcp_address:

View File

@ -1199,17 +1199,6 @@ class LinuxNetworkTestCase(test.NoDBTestCase):
driver.ensure_bridge('brq1234567-89', '') driver.ensure_bridge('brq1234567-89', '')
device_exists.assert_called_once_with('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): def test_set_device_mtu_default(self):
calls = [] calls = []
with mock.patch.object(utils, 'execute', return_value=('', '')) as ex: 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.assertFalse(mock_set_device_mtu.called)
self.assertTrue(mock_vsctl.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): def _create_veth_pair(self, calls):
with mock.patch.object(utils, 'execute', return_value=('', '')) as ex: with mock.patch.object(utils, 'execute', return_value=('', '')) as ex:
linux_net._create_veth_pair('fake-dev1', 'fake-dev2') linux_net._create_veth_pair('fake-dev1', 'fake-dev2')
@ -1315,28 +1286,6 @@ class LinuxNetworkTestCase(test.NoDBTestCase):
] ]
self._create_veth_pair(calls) 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): def test_exec_ebtables_success(self):
executes = [] executes = []

View File

@ -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.