Add MTU support to Linux bridge.
Fixes bug 1030932 Added MTU parity to Linux bridge interface driver. Change-Id: I020b009a32f9317d3bb1224ad03dda291c715e96
This commit is contained in:
@@ -178,6 +178,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)
|
||||
|
||||
@@ -260,7 +260,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')
|
||||
|
||||
@@ -289,6 +289,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)
|
||||
|
||||
@@ -306,6 +309,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:
|
||||
|
||||
Reference in New Issue
Block a user