summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Lynn <ethanlynnl@vmware.com>2018-09-19 10:51:36 +0800
committerEthan Lynn <ethanlynnl@vmware.com>2018-09-19 10:52:58 +0800
commit2ff05bc6f9f8b049fb8334dcf9fb57d62eafb174 (patch)
tree841f904469bc7aef127437bf3f1699d47a25682d
parent27b37133f342e70eca204aed42c9a969ea03aa27 (diff)
Register SRIOV capabilities to A&AI
Expose SRIOV capabilities in VIO plugin Change-Id: I78022600bb8cb0815ccef82d4afe24a80b438646 Issue-ID: MULTICLOUD-347 Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
-rw-r--r--vio/vio/pub/utils/restcall.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/vio/vio/pub/utils/restcall.py b/vio/vio/pub/utils/restcall.py
index 12934ff..d647770 100644
--- a/vio/vio/pub/utils/restcall.py
+++ b/vio/vio/pub/utils/restcall.py
@@ -526,6 +526,13 @@ class AAIClient(object):
logger.debug("pci_passthrough_capabilities_info: %s" % caps_dict)
hpa_caps.append(caps_dict)
+ # SRIOV NIC capabilities
+ caps_dict = self._get_sriov_nic_capabilities(
+ flavor['extra_specs'])
+ if len(caps_dict) > 0:
+ logger.debug("sriov_nic_capabilities_info: %s" % caps_dict)
+ hpa_caps.append(caps_dict)
+
# ovsdpdk capabilities
caps_dict = self._get_ovsdpdk_capabilities()
if len(caps_dict) > 0:
@@ -814,3 +821,36 @@ class AAIClient(object):
{'value': cloud_dpdk_info.get("libversion")})
})
return ovsdpdk_capability
+
+ def _get_sriov_nic_capabilities(self, extra_specs):
+ sriov_capability = {}
+ feature_uuid = uuid.uuid4()
+
+ if extra_specs.get('sriov_nic'):
+ value1 = extra_specs['sriov_nic'].split(':')
+ value2 = value1[0].split('-')
+
+ sriov_capability['hpa-capability-id'] = str(feature_uuid)
+ sriov_capability['hpa-feature'] = 'sriovNICNetwork'
+ sriov_capability['architecture'] = str(value2[2])
+ sriov_capability['hpa-version'] = 'v1'
+
+ sriov_capability['hpa-feature-attributes'] = []
+ sriov_capability['hpa-feature-attributes'].append({
+ 'hpa-attribute-key': 'pciCount',
+ 'hpa-attribute-value': json.dumps({'value': value1[1]})
+ })
+ sriov_capability['hpa-feature-attributes'].append({
+ 'hpa-attribute-key': 'pciVendorId',
+ 'hpa-attribute-value': json.dumps({'value': value2[3]})
+ })
+ sriov_capability['hpa-feature-attributes'].append({
+ 'hpa-attribute-key': 'pciDeviceId',
+ 'hpa-attribute-value': json.dumps(value2[4])
+ })
+ sriov_capability['hpa-feature-attributes'].append({
+ 'hpa-attribute-key': 'physicalNetwork',
+ 'hpa-attribute-value': json.dumps(value2[5])
+ })
+
+ return sriov_capability