dpdk: set global mtu to the dpdk interfaces
Change-Id: I7d3c5fbd15b993e2ce8d48fac049ecab5e401fae Closes-Bug: 1827256 Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
This commit is contained in:
parent
068471e6e5
commit
440d6f0f49
|
@ -531,6 +531,8 @@ def configure_ovs():
|
||||||
else:
|
else:
|
||||||
add_ovsbridge_linuxbridge(br, port)
|
add_ovsbridge_linuxbridge(br, port)
|
||||||
else:
|
else:
|
||||||
|
global_mtu = (
|
||||||
|
neutron_ovs_context.NeutronAPIContext()()['global_physnet_mtu'])
|
||||||
# NOTE: when in dpdk mode, add based on pci bus order
|
# NOTE: when in dpdk mode, add based on pci bus order
|
||||||
# with type 'dpdk'
|
# with type 'dpdk'
|
||||||
bridgemaps = neutron_ovs_context.resolve_dpdk_bridges()
|
bridgemaps = neutron_ovs_context.resolve_dpdk_bridges()
|
||||||
|
@ -546,6 +548,10 @@ def configure_ovs():
|
||||||
|
|
||||||
dpdk_add_bridge_port(br, portname,
|
dpdk_add_bridge_port(br, portname,
|
||||||
pci_address)
|
pci_address)
|
||||||
|
# TODO(sahid): We should also take into account the
|
||||||
|
# "physical-network-mtus" in case different MTUs are
|
||||||
|
# configured based on physical networks.
|
||||||
|
dpdk_set_mtu_request(portname, global_mtu)
|
||||||
device_index += 1
|
device_index += 1
|
||||||
|
|
||||||
if modern_ovs:
|
if modern_ovs:
|
||||||
|
|
|
@ -38,6 +38,7 @@ TO_PATCH = [
|
||||||
'dpdk_add_bridge_port',
|
'dpdk_add_bridge_port',
|
||||||
'dpdk_add_bridge_bond',
|
'dpdk_add_bridge_bond',
|
||||||
'dpdk_set_bond_config',
|
'dpdk_set_bond_config',
|
||||||
|
'dpdk_set_mtu_request',
|
||||||
'apt_install',
|
'apt_install',
|
||||||
'apt_update',
|
'apt_update',
|
||||||
'config',
|
'config',
|
||||||
|
@ -686,52 +687,66 @@ class TestNeutronOVSUtils(CharmTestCase):
|
||||||
'0000:001c.03')],
|
'0000:001c.03')],
|
||||||
any_order=True
|
any_order=True
|
||||||
)
|
)
|
||||||
|
self.dpdk_set_mtu_request.assert_has_calls([
|
||||||
|
call(_resolve_port_name('0000:001c.01',
|
||||||
|
0, _late_init), 1500),
|
||||||
|
call(_resolve_port_name('0000:001c.02',
|
||||||
|
1, _late_init), 1500),
|
||||||
|
call(_resolve_port_name('0000:001c.03',
|
||||||
|
2, _late_init), 1500)],
|
||||||
|
any_order=True)
|
||||||
|
|
||||||
|
@patch.object(neutron_ovs_context, 'NeutronAPIContext')
|
||||||
@patch.object(neutron_ovs_context, 'resolve_dpdk_bonds')
|
@patch.object(neutron_ovs_context, 'resolve_dpdk_bonds')
|
||||||
@patch.object(neutron_ovs_context, 'resolve_dpdk_bridges')
|
@patch.object(neutron_ovs_context, 'resolve_dpdk_bridges')
|
||||||
@patch.object(nutils, 'use_dvr')
|
@patch.object(nutils, 'use_dvr')
|
||||||
@patch('charmhelpers.contrib.openstack.context.config')
|
@patch('charmhelpers.contrib.openstack.context.config')
|
||||||
def test_configure_ovs_dpdk(self, mock_config, _use_dvr,
|
def test_configure_ovs_dpdk(self, mock_config, _use_dvr,
|
||||||
_resolve_dpdk_bridges,
|
_resolve_dpdk_bridges,
|
||||||
_resolve_dpdk_bonds):
|
_resolve_dpdk_bonds,
|
||||||
|
_NeutronAPIContext):
|
||||||
|
_NeutronAPIContext.return_value = DummyContext(
|
||||||
|
return_value={'global_physnet_mtu': 1500})
|
||||||
return self._run_configure_ovs_dpdk(mock_config, _use_dvr,
|
return self._run_configure_ovs_dpdk(mock_config, _use_dvr,
|
||||||
_resolve_dpdk_bridges,
|
_resolve_dpdk_bridges,
|
||||||
_resolve_dpdk_bonds,
|
_resolve_dpdk_bonds,
|
||||||
_late_init=False,
|
_late_init=False,
|
||||||
_test_bonds=False)
|
_test_bonds=False)
|
||||||
|
|
||||||
|
@patch.object(neutron_ovs_context, 'NeutronAPIContext')
|
||||||
@patch.object(neutron_ovs_context, 'resolve_dpdk_bonds')
|
@patch.object(neutron_ovs_context, 'resolve_dpdk_bonds')
|
||||||
@patch.object(neutron_ovs_context, 'resolve_dpdk_bridges')
|
@patch.object(neutron_ovs_context, 'resolve_dpdk_bridges')
|
||||||
@patch.object(nutils, 'use_dvr')
|
@patch.object(nutils, 'use_dvr')
|
||||||
@patch('charmhelpers.contrib.openstack.context.config')
|
@patch('charmhelpers.contrib.openstack.context.config')
|
||||||
def test_configure_ovs_dpdk_late_init(self, mock_config, _use_dvr,
|
def test_configure_ovs_dpdk_late_init(self, mock_config, _use_dvr,
|
||||||
_resolve_dpdk_bridges,
|
_resolve_dpdk_bridges,
|
||||||
_resolve_dpdk_bonds):
|
_resolve_dpdk_bonds,
|
||||||
|
_NeutronAPIContext):
|
||||||
|
_NeutronAPIContext.return_value = DummyContext(
|
||||||
|
return_value={'global_physnet_mtu': 1500})
|
||||||
return self._run_configure_ovs_dpdk(mock_config, _use_dvr,
|
return self._run_configure_ovs_dpdk(mock_config, _use_dvr,
|
||||||
_resolve_dpdk_bridges,
|
_resolve_dpdk_bridges,
|
||||||
_resolve_dpdk_bonds,
|
_resolve_dpdk_bonds,
|
||||||
_late_init=True,
|
_late_init=True,
|
||||||
_test_bonds=False)
|
_test_bonds=False)
|
||||||
|
|
||||||
|
@patch.object(neutron_ovs_context, 'NeutronAPIContext')
|
||||||
@patch.object(neutron_ovs_context, 'resolve_dpdk_bonds')
|
@patch.object(neutron_ovs_context, 'resolve_dpdk_bonds')
|
||||||
@patch.object(neutron_ovs_context, 'resolve_dpdk_bridges')
|
@patch.object(neutron_ovs_context, 'resolve_dpdk_bridges')
|
||||||
@patch.object(nutils, 'use_dvr')
|
@patch.object(nutils, 'use_dvr')
|
||||||
@patch('charmhelpers.contrib.openstack.context.config')
|
@patch('charmhelpers.contrib.openstack.context.config')
|
||||||
def test_configure_ovs_dpdk_late_init_bonds(self, mock_config, _use_dvr,
|
def test_configure_ovs_dpdk_late_init_bonds(self, mock_config, _use_dvr,
|
||||||
_resolve_dpdk_bridges,
|
_resolve_dpdk_bridges,
|
||||||
_resolve_dpdk_bonds):
|
_resolve_dpdk_bonds,
|
||||||
|
_NeutronAPIContext):
|
||||||
|
_NeutronAPIContext.return_value = DummyContext(
|
||||||
|
return_value={'global_physnet_mtu': 1500})
|
||||||
return self._run_configure_ovs_dpdk(mock_config, _use_dvr,
|
return self._run_configure_ovs_dpdk(mock_config, _use_dvr,
|
||||||
_resolve_dpdk_bridges,
|
_resolve_dpdk_bridges,
|
||||||
_resolve_dpdk_bonds,
|
_resolve_dpdk_bonds,
|
||||||
_late_init=True,
|
_late_init=True,
|
||||||
_test_bonds=True)
|
_test_bonds=True)
|
||||||
|
|
||||||
@patch.object(nutils, 'subprocess')
|
|
||||||
def test_dpdk_set_mtu_request(self, mock_subprocess):
|
|
||||||
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, 'use_dvr')
|
@patch.object(nutils, 'use_dvr')
|
||||||
@patch('charmhelpers.contrib.openstack.context.config')
|
@patch('charmhelpers.contrib.openstack.context.config')
|
||||||
def test_configure_ovs_enable_ipfix(self, mock_config, mock_use_dvr):
|
def test_configure_ovs_enable_ipfix(self, mock_config, mock_use_dvr):
|
||||||
|
@ -987,3 +1002,15 @@ class TestDPDKBondsConfig(CharmTestCase):
|
||||||
'lacp': 'off',
|
'lacp': 'off',
|
||||||
'lacp-time': 'fast'
|
'lacp-time': 'fast'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
class TestMTURequest(CharmTestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestMTURequest, self).setUp(nutils, [])
|
||||||
|
|
||||||
|
@patch.object(nutils, 'subprocess')
|
||||||
|
def test_dpdk_set_mtu_request(self, mock_subprocess):
|
||||||
|
nutils.dpdk_set_mtu_request("dpdk1", 9000)
|
||||||
|
mock_subprocess.check_call.assert_called_once_with(
|
||||||
|
['ovs-vsctl', 'set', 'Interface', 'dpdk1', 'mtu_request=9000'])
|
||||||
|
|
Loading…
Reference in New Issue