Skip to content

Commit

Permalink
Add MTU support to Linux bridge.
Browse files Browse the repository at this point in the history
Fixes bug 1030932

Added MTU parity to Linux bridge interface driver.

Change-Id: I020b009a32f9317d3bb1224ad03dda291c715e96
  • Loading branch information
cleverdevil committed Oct 23, 2012
1 parent 12ed618 commit 3316ee0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions quantum/agent/linux/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ def plug(self, network_id, port_id, device_name, mac_address,
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)
Expand Down
10 changes: 9 additions & 1 deletion quantum/tests/unit/test_linux_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def test_plug_no_ns(self):
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')

Expand Down Expand Up @@ -289,6 +289,9 @@ def device_exists(device, root_helper=None, namespace=None):
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)

Expand All @@ -306,6 +309,11 @@ def test_plug_dev_exists(self):
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:
Expand Down

0 comments on commit 3316ee0

Please sign in to comment.