Set MTU on dpdk devices when using a bond
MTU is not being set on the dpdk devices when a dpdk bond is being requested. Currently the mtu is being set in neutron_ovs_utils.configure_ovs by iterating over the dictionary returned by neutron_ovs_context.resolve_dpdk_bridges. But this context is expecting the data-port config option to be a list of bridge:mac mappings. In the case of a dpdk bond however, data-port is set of bridge:bond-name mappings. The context then uses the bond name as if it were a mac address to find the underlying pci device which naturally fails and then returns an empty context. This is fine as configure_ovs then moves on to setup the dpdk bonds correctly. Unfortunately the code to apply mtus to the devices in the case of a bond was missing and this change adds it in. Change-Id: I2fb8ccf48ffd1a3ab227b883ceacac89ff57ea02
This commit is contained in:
parent
fc7c7b3885
commit
38452772a9
|
@ -574,6 +574,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)
|
||||
|
@ -799,6 +802,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()
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
@ -674,6 +675,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',
|
||||
|
@ -1035,3 +1041,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)
|
||||
|
|
Loading…
Reference in New Issue