From 1fc775ff7cabcecafd8f373e9474599057422a0a Mon Sep 17 00:00:00 2001 From: Yun Huang Date: Mon, 26 Mar 2018 15:37:56 +0800 Subject: Add HPA cpu instruction set capabilities for TC Change-Id: I8047bd583b682e1e099efe1c1b55078761004d5f Issue-ID: MULTICLOUD-200 Signed-off-by: Yun Huang --- .../registration/views/registration.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'windriver') diff --git a/windriver/titanium_cloud/registration/views/registration.py b/windriver/titanium_cloud/registration/views/registration.py index c47a75d5..a7103056 100644 --- a/windriver/titanium_cloud/registration/views/registration.py +++ b/windriver/titanium_cloud/registration/views/registration.py @@ -118,6 +118,12 @@ class Registry(newton_registration.Registry): self._logger.debug("storage_capabilities_info: %s" % caps_dict) hpa_caps.append(caps_dict) + # CPU instruction set extension capabilities + caps_dict = self._get_instruction_set_capabilities(flavor) + if len(caps_dict) > 0: + self._logger.debug("instruction_set_capabilities_info: %s" % caps_dict) + hpa_caps.append(caps_dict) + return hpa_caps def _get_hpa_basic_capabilities(self, flavor): @@ -240,3 +246,19 @@ class Registry(newton_registration.Registry): storage_capability['attributes'].append({'hpa-attribute-key': 'ephemeralDiskSize', 'hpa-attribute-value':{'value': str(flavor['OS-FLV-EXT-DATA:ephemeral']), 'unit':'GB'}}) return storage_capability + + def _get_instruction_set_capabilities(self, extra_specs): + instruction_capability = {} + feature_uuid = uuid.uuid4() + + if extra_specs.has_key('hw:capabilities:cpu_info:features'): + instruction_capability['hpaCapabilityID'] = str(feature_uuid) + instruction_capability['hpaFeature'] = 'instructionSetExtensions' + instruction_capability['hardwareArchitecture'] = 'Intel64' + instruction_capability['version'] = 'v1' + + instruction_capability['attributes'] = [] + instruction_capability['attributes'].append({'hpa-attribute-key': 'instructionSetExtensions', + 'hpa-attribute-value':{'value': str(extra_specs['hw:capabilities:cpu_info:features'])}}) + return instruction_capability + -- cgit 1.2.3-korg