Browse Source

Add support for NIC attributes

Provide support for SR-IOV and DPDK through new API version
for NICs.

Change-Id: I1a927c0e7333a422f94dd2937638f8d2ca38512f
Implements: blueprint nics-and-nodes-attributes-via-plugin
tags/10.0.0rc1
Andriy Popovych 2 years ago
parent
commit
7531f8d65a
2 changed files with 44 additions and 16 deletions
  1. 28
    9
      fuel_health/config.py
  2. 16
    7
      fuel_plugin/ostf_adapter/mixins.py

+ 28
- 9
fuel_health/config.py View File

@@ -752,10 +752,18 @@ class NailgunConfig(object):
752 752
             ifaces_resp = self.req_session.get(
753 753
                 self.nailgun_url + api_url).json()
754 754
             for iface in ifaces_resp:
755
-                if ('sriov' in iface['interface_properties'] and
756
-                        iface['interface_properties']['sriov']['enabled']):
757
-                    sriov_physnets.append(
758
-                        iface['interface_properties']['sriov']['physnet'])
755
+                if 'interface_properties' in iface:
756
+                    if ('sriov' in iface['interface_properties'] and
757
+                            iface['interface_properties'][
758
+                                'sriov']['enabled']):
759
+                        sriov_physnets.append(
760
+                            iface['interface_properties']['sriov']['physnet'])
761
+                else:
762
+                    if ('sriov' in iface['attributes'] and
763
+                            iface['attributes']['sriov']['enabled']['value']):
764
+                        sriov_physnets.append(
765
+                            iface['attributes']['sriov']['physnet']['value'])
766
+
759 767
         self.compute.sriov_physnets = sriov_physnets
760 768
 
761 769
         # Find first compute with enabled DPDK
@@ -764,11 +772,22 @@ class NailgunConfig(object):
764 772
             ifaces_resp = self.req_session.get(
765 773
                 self.nailgun_url + api_url).json()
766 774
             for iface in ifaces_resp:
767
-                if 'dpdk' in iface['interface_properties']:
768
-                    if 'enabled' in iface['interface_properties']['dpdk']:
769
-                        if iface['interface_properties']['dpdk']['enabled']:
770
-                            self.compute.dpdk_compute_fqdn = compute['fqdn']
771
-                            break
775
+                if 'interface_properties' in iface:
776
+                    if 'dpdk' in iface['interface_properties']:
777
+                        if 'enabled' in iface['interface_properties']['dpdk']:
778
+                            if iface['interface_properties'][
779
+                                    'dpdk']['enabled']:
780
+                                self.compute.dpdk_compute_fqdn = compute[
781
+                                    'fqdn']
782
+                                break
783
+                else:
784
+                    if 'dpdk' in iface['attributes']:
785
+                        if 'enabled' in iface['attributes']['dpdk']:
786
+                            if iface['attributes']['dpdk'][
787
+                                    'enabled']['value']:
788
+                                self.compute.dpdk_compute_fqdn = compute[
789
+                                    'fqdn']
790
+                                break
772 791
 
773 792
         self.compute.compute_nodes = compute_ips
774 793
         ceph_nodes = filter(lambda node: 'ceph-osd' in node['roles'],

+ 16
- 7
fuel_plugin/ostf_adapter/mixins.py View File

@@ -168,13 +168,22 @@ def _get_cluster_attrs(cluster_id, token=None):
168 168
             'api/nodes/{id}/interfaces'.format(id=compute_id))
169 169
         ifaces_resp = REQ_SES.get(ifaces_url).json()
170 170
         for iface in ifaces_resp:
171
-            if ('sriov' in iface['interface_properties'] and
172
-                    iface['interface_properties']['sriov']['enabled']):
173
-                sriov_compute_ids.append(compute_id)
174
-            if 'dpdk' in iface['interface_properties']:
175
-                if 'enabled' in iface['interface_properties']['dpdk']:
176
-                    if iface['interface_properties']['dpdk']['enabled']:
177
-                        dpdk_compute_ids.append(compute_id)
171
+            if 'interface_properties' in iface:
172
+                if ('sriov' in iface['interface_properties'] and
173
+                        iface['interface_properties']['sriov']['enabled']):
174
+                    sriov_compute_ids.append(compute_id)
175
+                if 'dpdk' in iface['interface_properties']:
176
+                    if 'enabled' in iface['interface_properties']['dpdk']:
177
+                        if iface['interface_properties']['dpdk']['enabled']:
178
+                            dpdk_compute_ids.append(compute_id)
179
+            else:
180
+                if ('sriov' in iface['attributes'] and
181
+                        iface['attributes']['sriov']['enabled']['value']):
182
+                    sriov_compute_ids.append(compute_id)
183
+                if 'dpdk' in iface['attributes']:
184
+                    if 'enabled' in iface['attributes']['dpdk']:
185
+                        if iface['attributes']['dpdk']['enabled']['value']:
186
+                            dpdk_compute_ids.append(compute_id)
178 187
 
179 188
     deployment_tags = set()
180 189
 

Loading…
Cancel
Save