summaryrefslogtreecommitdiffstats
path: root/windriver/titanium_cloud
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-03-26 16:16:11 +0800
committerYun Huang <yun.huang@windriver.com>2018-03-26 16:16:11 +0800
commit602da8239732a2c4cd8cdc67a0aaa58ee9a775fb (patch)
tree45a5b3609b4ac729f0d7e2746206971f8f934401 /windriver/titanium_cloud
parent5534ba84270dbc8154fa34bd9a3d81620b6a1277 (diff)
Add HPA PCI passthrough capabilities for TC
Change-Id: I22909cd842cbb1df038dc6aeb4e2d45198566a07 Issue-ID: MULTICLOUD-200 Signed-off-by: Yun Huang <yun.huang@windriver.com>
Diffstat (limited to 'windriver/titanium_cloud')
-rw-r--r--windriver/titanium_cloud/registration/views/registration.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/windriver/titanium_cloud/registration/views/registration.py b/windriver/titanium_cloud/registration/views/registration.py
index 4db8e987..992353ca 100644
--- a/windriver/titanium_cloud/registration/views/registration.py
+++ b/windriver/titanium_cloud/registration/views/registration.py
@@ -124,6 +124,12 @@ class Registry(newton_registration.Registry):
self._logger.debug("instruction_set_capabilities_info: %s" % caps_dict)
hpa_caps.append(caps_dict)
+ # PCI passthrough capabilities
+ caps_dict = self._get_pci_passthrough_capabilities(extra_specs)
+ if len(caps_dict) > 0:
+ self._logger.debug("pxi_passthrough_capabilities_info: %s" % caps_dict)
+ hpa_caps.append(caps_dict)
+
return hpa_caps
def _get_hpa_basic_capabilities(self, flavor):
@@ -262,3 +268,26 @@ class Registry(newton_registration.Registry):
'hpa-attribute-value':{'value': str(extra_specs['hw:capabilities:cpu_info:features'])}})
return instruction_capability
+ def _get_pci_passthrough_capabilities(self, extra_specs):
+ instruction_capability = {}
+ feature_uuid = uuid.uuid4()
+
+ if extra_specs.has_key('pci_passthrough:alias'):
+ value1 = extra_specs['pci_passthrough:alias'].split(':')
+ value2 = value1[0].split('-')
+
+ instruction_capability['hpaCapabilityID'] = str(feature_uuid)
+ instruction_capability['hpaFeature'] = 'pciePassthrough'
+ instruction_capability['hardwareArchitecture'] = str(value2[2])
+ instruction_capability['version'] = 'v1'
+
+
+ instruction_capability['attributes'] = []
+ instruction_capability['attributes'].append({'hpa-attribute-key': 'pciCount',
+ 'hpa-attribute-value':{'value': str(value1[1])}})
+ instruction_capability['attributes'].append({'hpa-attribute-key': 'pciVendorId',
+ 'hpa-attribute-value':{'value': str(value2[3])}})
+ instruction_capability['attributes'].append({'hpa-attribute-key': 'pciDeviceId',
+ 'hpa-attribute-value':{'value': str(value2[4])}})
+
+ return instruction_capability