Browse Source

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>
Mikhail 2 years ago
parent
commit
9c51c8e22b

+ 4
- 0
nailgun/nailgun/consts.py View File

@@ -528,3 +528,7 @@ HYPERVISORS = Enum(
528 528
 )
529 529
 
530 530
 DPDK_DRIVER_IN_SRIOV_CASE = 'vfio-pci'
531
+
532
+DEFAULT_MTU = 1500
533
+
534
+SIZE_OF_VLAN_TAG = 4

+ 23
- 0
nailgun/nailgun/extensions/network_manager/managers/neutron.py View File

@@ -554,3 +554,26 @@ class NeutronManager70(
554 554
 
555 555
 class NeutronManager80(AllocateVIPs80Mixin, NeutronManager70):
556 556
     pass
557
+
558
+
559
+class NeutronManager90(NeutronManager80):
560
+    @classmethod
561
+    def get_iface_properties(cls, iface):
562
+        result = super(NeutronManager80, cls).get_iface_properties(iface)
563
+
564
+        if (iface.type == consts.NETWORK_INTERFACE_TYPES.ether and
565
+                iface.driver == 'i40e' and
566
+                objects.NIC.dpdk_enabled(iface)):
567
+            # On NIC with i40e driver MTU should be increased manually
568
+            # because driver automatically sets value 4 bytes less
569
+            # LP 1587310
570
+            mtu = result.get('mtu')
571
+            if mtu:
572
+                result.update({
573
+                    'mtu': mtu + consts.SIZE_OF_VLAN_TAG
574
+                })
575
+            else:
576
+                result.update({
577
+                    'mtu': consts.DEFAULT_MTU + consts.SIZE_OF_VLAN_TAG
578
+                })
579
+        return result

+ 3
- 1
nailgun/nailgun/objects/cluster.py View File

@@ -517,8 +517,10 @@ class Cluster(NailgunObject):
517 517
             if StrictVersion(ver) == StrictVersion('7.0'):
518 518
                 return neutron.NeutronManager70
519 519
 
520
-            if StrictVersion(ver) >= StrictVersion('8.0'):
520
+            if StrictVersion(ver) == StrictVersion('8.0'):
521 521
                 return neutron.NeutronManager80
522
+            if StrictVersion(ver) >= StrictVersion('9.0'):
523
+                return neutron.NeutronManager90
522 524
 
523 525
             return neutron.NeutronManager
524 526
         elif net_provider == consts.CLUSTER_NET_PROVIDERS.nova_network:

+ 12
- 1
nailgun/nailgun/test/integration/test_orchestrator_serializer_90.py View File

@@ -131,7 +131,7 @@ class TestDeploymentAttributesSerialization90(
131 131
     @mock.patch('nailgun.objects.Release.get_supported_dpdk_drivers')
132 132
     def _check_dpdk_serializing(self, drivers_mock, has_vlan_tag=False,
133 133
                                 sriov=False, max_queues=0,
134
-                                dpdk_cpu_pinning=0):
134
+                                dpdk_cpu_pinning=0, nic_driver=None):
135 135
         drivers_mock.return_value = {
136 136
             'driver_1': ['test_id:1', 'test_id:2']
137 137
         }
@@ -154,6 +154,8 @@ class TestDeploymentAttributesSerialization90(
154 154
         dpdk_nic.meta['max_queues'] = max_queues
155 155
         if dpdk_cpu_pinning:
156 156
             node.attributes['cpu_pinning']['dpdk']['value'] = dpdk_cpu_pinning
157
+        if nic_driver:
158
+            dpdk_nic.driver = nic_driver
157 159
 
158 160
         objects.Cluster.prepare_for_deployment(self.cluster_db)
159 161
 
@@ -205,6 +207,9 @@ class TestDeploymentAttributesSerialization90(
205 207
                              min(max_queues, dpdk_cpu_pinning - 1))
206 208
         else:
207 209
             self.assertFalse('max_queues' in vendor_specific)
210
+        if nic_driver:
211
+            self.assertEqual(dpdk_interface['mtu'],
212
+                             consts.DEFAULT_MTU + consts.SIZE_OF_VLAN_TAG)
208 213
 
209 214
     def test_serialization_with_dpdk(self):
210 215
         self._check_dpdk_serializing()
@@ -220,6 +225,12 @@ class TestDeploymentAttributesSerialization90(
220 225
         self._create_cluster_with_vxlan()
221 226
         self._check_dpdk_serializing(has_vlan_tag=True)
222 227
 
228
+    def test_serialization_with_dpdk_with_i40e_driver(self):
229
+        driver = 'i40e'
230
+        dpdk_cpu_pinning = 4
231
+        self._check_dpdk_serializing(nic_driver=driver,
232
+                                     dpdk_cpu_pinning=dpdk_cpu_pinning)
233
+
223 234
     def test_serialization_with_dpdk_queues_limited_max_queues(self):
224 235
         max_queues = 2
225 236
         dpdk_cpu_pinning = 4

+ 1
- 0
nailgun/nailgun/test/unit/test_objects.py View File

@@ -1858,6 +1858,7 @@ class TestClusterObjectGetNetworkManager(BaseTestCase):
1858 1858
             ('2014.2.2-6.1', neutron.NeutronManager61),
1859 1859
             ('2015.6.7-7.0', neutron.NeutronManager70),
1860 1860
             ('2016.1.1-8.0', neutron.NeutronManager80),
1861
+            ('mitaka-9.0', neutron.NeutronManager90)
1861 1862
         ):
1862 1863
             self.check_neutron_network_manager(
1863 1864
                 consts.CLUSTER_NET_PROVIDERS.neutron,

Loading…
Cancel
Save