Merge "dpdk: set global mtu to the dpdk interfaces"
This commit is contained in:
commit
0610e920a7
|
@ -531,6 +531,8 @@ def configure_ovs():
|
|||
else:
|
||||
add_ovsbridge_linuxbridge(br, port)
|
||||
else:
|
||||
global_mtu = (
|
||||
neutron_ovs_context.NeutronAPIContext()()['global_physnet_mtu'])
|
||||
# NOTE: when in dpdk mode, add based on pci bus order
|
||||
# with type 'dpdk'
|
||||
bridgemaps = neutron_ovs_context.resolve_dpdk_bridges()
|
||||
|
@ -546,6 +548,10 @@ def configure_ovs():
|
|||
|
||||
dpdk_add_bridge_port(br, portname,
|
||||
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
|
||||
|
||||
if modern_ovs:
|
||||
|
|
|
@ -38,6 +38,7 @@ TO_PATCH = [
|
|||
'dpdk_add_bridge_port',
|
||||
'dpdk_add_bridge_bond',
|
||||
'dpdk_set_bond_config',
|
||||
'dpdk_set_mtu_request',
|
||||
'apt_install',
|
||||
'apt_update',
|
||||
'config',
|
||||
|
@ -688,52 +689,66 @@ class TestNeutronOVSUtils(CharmTestCase):
|
|||
'0000:001c.03')],
|
||||
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_bridges')
|
||||
@patch.object(nutils, 'use_dvr')
|
||||
@patch('charmhelpers.contrib.openstack.context.config')
|
||||
def test_configure_ovs_dpdk(self, mock_config, _use_dvr,
|
||||
_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,
|
||||
_resolve_dpdk_bridges,
|
||||
_resolve_dpdk_bonds,
|
||||
_late_init=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_bridges')
|
||||
@patch.object(nutils, 'use_dvr')
|
||||
@patch('charmhelpers.contrib.openstack.context.config')
|
||||
def test_configure_ovs_dpdk_late_init(self, mock_config, _use_dvr,
|
||||
_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,
|
||||
_resolve_dpdk_bridges,
|
||||
_resolve_dpdk_bonds,
|
||||
_late_init=True,
|
||||
_test_bonds=False)
|
||||
|
||||
@patch.object(neutron_ovs_context, 'NeutronAPIContext')
|
||||
@patch.object(neutron_ovs_context, 'resolve_dpdk_bonds')
|
||||
@patch.object(neutron_ovs_context, 'resolve_dpdk_bridges')
|
||||
@patch.object(nutils, 'use_dvr')
|
||||
@patch('charmhelpers.contrib.openstack.context.config')
|
||||
def test_configure_ovs_dpdk_late_init_bonds(self, mock_config, _use_dvr,
|
||||
_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,
|
||||
_resolve_dpdk_bridges,
|
||||
_resolve_dpdk_bonds,
|
||||
_late_init=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('charmhelpers.contrib.openstack.context.config')
|
||||
def test_configure_ovs_enable_ipfix(self, mock_config, mock_use_dvr):
|
||||
|
@ -989,3 +1004,15 @@ class TestDPDKBondsConfig(CharmTestCase):
|
|||
'lacp': 'off',
|
||||
'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