Merge "Set MTU on dpdk devices when using a bond"

This commit is contained in:
Zuul 2019-07-01 21:54:11 +00:00 committed by Gerrit Code Review
commit 1551f9c297
2 changed files with 29 additions and 0 deletions

View File

@ -586,6 +586,9 @@ def configure_ovs():
for br, bonds in bridge_bond_map.items():
for bond, port_map in bonds.items():
dpdk_add_bridge_bond(br, bond, port_map)
dpdk_set_interfaces_mtu(
global_mtu,
port_map.keys())
dpdk_set_bond_config(
bond,
bond_configs.get_bond_config(bond)
@ -822,6 +825,18 @@ def dpdk_set_mtu_request(port, mtu):
subprocess.check_call(cmd)
def dpdk_set_interfaces_mtu(mtu, ports):
"""Set MTU on dpdk ports.
:param mtu: Name of unit to match
:type mtu: str
:param ports: List of ports
:type ports: []
"""
for port in ports:
dpdk_set_mtu_request(port, mtu)
def enable_nova_metadata():
return use_dvr() or enable_local_dhcp()

View File

@ -39,6 +39,7 @@ TO_PATCH = [
'dpdk_add_bridge_bond',
'dpdk_set_bond_config',
'dpdk_set_mtu_request',
'dpdk_set_interfaces_mtu',
'apt_install',
'apt_update',
'config',
@ -684,6 +685,11 @@ class TestNeutronOVSUtils(CharmTestCase):
'lacp-time': 'fast'})],
any_order=True
)
self.dpdk_set_interfaces_mtu.assert_has_calls([
call(1500, {'dpdk-ac48d24': None}.keys()),
call(1500, {'dpdk-82c1c9e': None}.keys()),
call(1500, {'dpdk-aebdb4d': None}.keys())],
any_order=True)
else:
self.dpdk_add_bridge_port.assert_has_calls([
call('br-phynet1',
@ -1111,3 +1117,11 @@ class TestMTURequest(CharmTestCase):
nutils.dpdk_set_mtu_request("dpdk1", 9000)
mock_subprocess.check_call.assert_called_once_with(
['ovs-vsctl', 'set', 'Interface', 'dpdk1', 'mtu_request=9000'])
@patch.object(nutils, 'dpdk_set_mtu_request')
def test_dpdk_set_interfaces_mtu(self, mock_dpdk_set_mtu_request):
nutils.dpdk_set_interfaces_mtu('1234', ['nic1', 'nic2'])
expected_calls = [
call('nic1', '1234'),
call('nic2', '1234')]
mock_dpdk_set_mtu_request.assert_has_calls(expected_calls)