Serialize mtu for dpdk interface with 'i40e' driver
On NIC: XL710 with driver 'i40e' MTU does not take into
account 4 bytes VLAN tag, so we should increase it manually
DocImpact
Change-Id: I3d95db9ec6fae4d8cd397c429d785dbdf1502b21
Partial-Bug: #1587310
Co-Authored-By: Fedor Zhadaev <fzhadaev@mirantis.com>
(cherry picked from commit 737556d
)
This commit is contained in:
parent
f6baa58d1a
commit
747e897ae0
|
@ -531,3 +531,7 @@ HYPERVISORS = Enum(
|
|||
)
|
||||
|
||||
DPDK_DRIVER_IN_SRIOV_CASE = 'vfio-pci'
|
||||
|
||||
DEFAULT_MTU = 1500
|
||||
|
||||
SIZE_OF_VLAN_TAG = 4
|
||||
|
|
|
@ -32,6 +32,7 @@ from nailgun.network.manager import AssignIPs70Mixin
|
|||
from nailgun.network.manager import AssignIPsLegacyMixin
|
||||
from nailgun.network.manager import NetworkManager
|
||||
from nailgun import objects
|
||||
from nailgun import utils
|
||||
|
||||
from nailgun.orchestrator.neutron_serializers import \
|
||||
NeutronNetworkTemplateSerializer70
|
||||
|
@ -553,4 +554,28 @@ class NeutronManager70(
|
|||
|
||||
|
||||
class NeutronManager80(AllocateVIPs80Mixin, NeutronManager70):
|
||||
pass
|
||||
@classmethod
|
||||
def get_iface_properties(cls, iface):
|
||||
result = super(NeutronManager80, cls).get_iface_properties(iface)
|
||||
|
||||
if (iface.type == consts.NETWORK_INTERFACE_TYPES.ether and
|
||||
iface.driver == 'i40e' and
|
||||
objects.NIC.dpdk_enabled(iface)):
|
||||
# On NIC with i40e driver MTU should be increased manually
|
||||
# because driver automatically sets value 4 less
|
||||
# LP 1587310
|
||||
mtu = utils.get_in(result, 'mtu', 'value', 'value')
|
||||
if mtu:
|
||||
result.update({
|
||||
'mtu': {
|
||||
'value': {
|
||||
'value': mtu + consts.SIZE_OF_VLAN_TAG}
|
||||
}})
|
||||
else:
|
||||
result.update({
|
||||
'mtu': {
|
||||
'value': {
|
||||
'value':
|
||||
consts.DEFAULT_MTU + consts.SIZE_OF_VLAN_TAG}
|
||||
}})
|
||||
return result
|
||||
|
|
|
@ -136,7 +136,7 @@ class TestDeploymentAttributesSerialization90(
|
|||
@mock.patch('nailgun.objects.Release.get_supported_dpdk_drivers')
|
||||
def _check_dpdk_serializing(self, drivers_mock, has_vlan_tag=False,
|
||||
sriov=False, max_queues=0,
|
||||
dpdk_cpu_pinning=0):
|
||||
dpdk_cpu_pinning=0, nic_driver=None):
|
||||
drivers_mock.return_value = {
|
||||
'driver_1': ['test_id:1', 'test_id:2']
|
||||
}
|
||||
|
@ -159,6 +159,8 @@ class TestDeploymentAttributesSerialization90(
|
|||
dpdk_nic.meta['max_queues'] = max_queues
|
||||
if dpdk_cpu_pinning:
|
||||
node.attributes['cpu_pinning']['dpdk']['value'] = dpdk_cpu_pinning
|
||||
if nic_driver:
|
||||
dpdk_nic.driver = nic_driver
|
||||
|
||||
objects.Cluster.prepare_for_deployment(self.cluster_db)
|
||||
|
||||
|
@ -207,6 +209,9 @@ class TestDeploymentAttributesSerialization90(
|
|||
min(max_queues, dpdk_cpu_pinning - 1))
|
||||
else:
|
||||
self.assertFalse('max_queues' in vendor_specific)
|
||||
if nic_driver:
|
||||
self.assertEqual(dpdk_interface['mtu']['value']['value'],
|
||||
consts.DEFAULT_MTU + consts.SIZE_OF_VLAN_TAG)
|
||||
|
||||
def test_serialization_with_dpdk(self):
|
||||
self._check_dpdk_serializing()
|
||||
|
@ -222,6 +227,12 @@ class TestDeploymentAttributesSerialization90(
|
|||
self._create_cluster_with_vxlan()
|
||||
self._check_dpdk_serializing(has_vlan_tag=True)
|
||||
|
||||
def test_serialization_with_dpdk_with_i40e_driver(self):
|
||||
driver = 'i40e'
|
||||
dpdk_cpu_pinning = 4
|
||||
self._check_dpdk_serializing(nic_driver=driver,
|
||||
dpdk_cpu_pinning=dpdk_cpu_pinning)
|
||||
|
||||
def test_serialization_with_dpdk_queues_limited_max_queues(self):
|
||||
max_queues = 2
|
||||
dpdk_cpu_pinning = 4
|
||||
|
|
Loading…
Reference in New Issue