diff --git a/quantum/agent/linux/interface.py b/quantum/agent/linux/interface.py index 4330629e49..b3b5a8ac6a 100644 --- a/quantum/agent/linux/interface.py +++ b/quantum/agent/linux/interface.py @@ -219,6 +219,10 @@ class BridgeInterfaceDriver(LinuxInterfaceDriver): root_veth, dhcp_veth = ip.add_veth(tap_name, device_name) root_veth.link.set_address(mac_address) + if self.conf.network_device_mtu: + root_veth.link.set_mtu(self.conf.network_device_mtu) + dhcp_veth.link.set_mtu(self.conf.network_device_mtu) + if namespace: namespace_obj = ip.ensure_namespace(namespace) namespace_obj.add_device_to_namespace(dhcp_veth) diff --git a/quantum/tests/unit/test_linux_interface.py b/quantum/tests/unit/test_linux_interface.py index f449a73075..9dac1d84f1 100644 --- a/quantum/tests/unit/test_linux_interface.py +++ b/quantum/tests/unit/test_linux_interface.py @@ -272,7 +272,7 @@ class TestBridgeInterfaceDriver(TestBase): def test_plug_with_ns(self): self._test_plug(namespace='01234567-1234-1234-99') - def _test_plug(self, namespace=None): + def _test_plug(self, namespace=None, mtu=None): def device_exists(device, root_helper=None, namespace=None): return device.startswith('brq') @@ -301,6 +301,9 @@ class TestBridgeInterfaceDriver(TestBase): mock.call().ensure_namespace('01234567-1234-1234-99'), mock.call().ensure_namespace().add_device_to_namespace( ns_veth)]) + if mtu: + ns_veth.assert_has_calls([mock.call.link.set_mtu(mtu)]) + root_veth.assert_has_calls([mock.call.link.set_mtu(mtu)]) self.ip.assert_has_calls(ip_calls) @@ -318,6 +321,11 @@ class TestBridgeInterfaceDriver(TestBase): self.ip_dev.assert_has_calls([]) self.assertEquals(log.call_count, 1) + def test_plug_mtu(self): + self.device_exists.return_value = False + self.conf.set_override('network_device_mtu', 9000) + self._test_plug(mtu=9000) + def test_unplug(self): self.device_exists.return_value = True with mock.patch('quantum.agent.linux.interface.LOG.debug') as log: