Browse Source

Enable neutron sriov backend

This commit adds configuration of the sriov backend to neutron.
This commit also adds setting the sriov=enabled label in kube_app.

Story: 2003909
Task: 28835
Change-Id: If9c7c0b73382855dde4b539ca821a9ef8a2963b3
Signed-off-by: Joseph Richard <joseph.richard@windriver.com>
tags/final-non-containers
Joseph Richard 5 months ago
parent
commit
8d14f3cd52

+ 1
- 0
sysinv/sysinv/sysinv/sysinv/common/constants.py View File

@@ -1483,6 +1483,7 @@ APP_TARFILE_NAME_PLACEHOLDER = 'tarfile-placeholder'
1483 1483
 CONTROL_PLANE_LABEL = 'openstack-control-plane=enabled'
1484 1484
 COMPUTE_NODE_LABEL = 'openstack-compute-node=enabled'
1485 1485
 OPENVSWITCH_LABEL = 'openvswitch=enabled'
1486
+SRIOV_LABEL = 'sriov=enabled'
1486 1487
 
1487 1488
 # Default DNS service domain
1488 1489
 DEFAULT_DNS_SERVICE_DOMAIN = 'cluster.local'

+ 1
- 0
sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py View File

@@ -627,6 +627,7 @@ class AppOperator(object):
627 627
             controller_labels_set.add(constants.CONTROL_PLANE_LABEL)
628 628
             compute_labels_set.add(constants.COMPUTE_NODE_LABEL)
629 629
             compute_labels_set.add(constants.OPENVSWITCH_LABEL)
630
+            compute_labels_set.add(constants.SRIOV_LABEL)
630 631
 
631 632
         # Get controller host(s)
632 633
         controller_hosts =\

+ 42
- 2
sysinv/sysinv/sysinv/sysinv/helm/neutron.py View File

@@ -16,6 +16,7 @@ from sqlalchemy.orm.exc import NoResultFound
16 16
 LOG = logging.getLogger(__name__)
17 17
 
18 18
 DATA_NETWORK_TYPES = [constants.NETWORK_TYPE_DATA]
19
+SRIOV_NETWORK_TYPES = [constants.NETWORK_TYPE_PCI_SRIOV]
19 20
 
20 21
 
21 22
 class NeutronHelm(openstack.OpenstackBaseHelm):
@@ -44,12 +45,13 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
44 45
                     },
45 46
                     'replicas': {
46 47
                         'server': self._num_controllers()
47
-                    }
48
+                    },
48 49
                 },
49 50
                 'network': {
50 51
                     'interface': {
51 52
                         'tunnel': 'docker0'
52 53
                     },
54
+                    'backend': ['openvswitch', 'sriov'],
53 55
                 },
54 56
                 'conf': {
55 57
                     'neutron': self._get_neutron_config(),
@@ -84,6 +86,9 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
84 86
                         'neutron_metadata-agent': {
85 87
                             'hosts': self._get_per_host_overrides()
86 88
                         },
89
+                        'neutron_sriov-agent': {
90
+                            'hosts': self._get_per_host_overrides()
91
+                        },
87 92
                     }
88 93
                 },
89 94
                 'labels': self._get_labels_overrides(),
@@ -155,7 +160,8 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
155 160
                         'name': hostname,
156 161
                         'conf': {
157 162
                             'plugins': {
158
-                                'openvswitch_agent': self._get_dynamic_ovs_agent_config(host)
163
+                                'openvswitch_agent': self._get_dynamic_ovs_agent_config(host),
164
+                                'sriov_agent': self._get_dynamic_sriov_agent_config(host),
159 165
                             }
160 166
                         }
161 167
                     }
@@ -219,6 +225,27 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
219 225
             },
220 226
         }
221 227
 
228
+    def _get_dynamic_sriov_agent_config(self, host):
229
+        physical_device_mappings = ""
230
+        for iface in sorted(self.dbapi.iinterface_get_by_ihost(host.id),
231
+                            key=self._interface_sort_key):
232
+            if self._is_sriov_network_type(iface):
233
+                # obtain the assigned providernets for interface
234
+                providernets = self._get_interface_providernets(iface)
235
+                port_name = self._get_interface_port_name(iface)
236
+                for providernet in providernets:
237
+                    physical_device_mappings += ('%s:%s,' % (providernet, port_name))
238
+        sriov_nic = {
239
+            'physical_device_mappings': str(physical_device_mappings),
240
+        }
241
+
242
+        return {
243
+            'securitygroup': {
244
+                'firewall_driver': 'noop',
245
+            },
246
+            'sriov_nic': sriov_nic,
247
+        }
248
+
222 249
     def _get_neutron_config(self):
223 250
         neutron_config = {
224 251
             'DEFAULT': {
@@ -284,6 +311,10 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
284 311
         networktypelist = utils.get_network_type_list(iface)
285 312
         return bool(any(n in DATA_NETWORK_TYPES for n in networktypelist))
286 313
 
314
+    def _is_sriov_network_type(self, iface):
315
+        networktypelist = utils.get_network_type_list(iface)
316
+        return bool(any(n in SRIOV_NETWORK_TYPES for n in networktypelist))
317
+
287 318
     def _get_interface_providernets(self, iface):
288 319
         """
289 320
         Return the provider networks of the supplied interface as a list.
@@ -293,6 +324,15 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
293 324
             return []
294 325
         return [x.strip() for x in providernetworks.split(',')]
295 326
 
327
+    def _get_interface_port_name(self, iface):
328
+        """
329
+        Determine the port name of the underlying device.
330
+        """
331
+        assert iface['iftype'] == constants.INTERFACE_TYPE_ETHERNET
332
+        port = self.dbapi.port_get_by_interface(iface.id)
333
+        if port:
334
+            return port[0]['name']
335
+
296 336
     def _get_interface_primary_address(self, context, host, iface):
297 337
         """
298 338
         Determine the primary IP address on an interface (if any).  If multiple

Loading…
Cancel
Save