summaryrefslogtreecommitdiffstats
path: root/windriver
diff options
context:
space:
mode:
Diffstat (limited to 'windriver')
-rw-r--r--windriver/titanium_cloud/registration/tests/test_registration.py4
-rw-r--r--windriver/titanium_cloud/registration/views/registration.py30
2 files changed, 31 insertions, 3 deletions
diff --git a/windriver/titanium_cloud/registration/tests/test_registration.py b/windriver/titanium_cloud/registration/tests/test_registration.py
index 3dcbd547..3e8c5612 100644
--- a/windriver/titanium_cloud/registration/tests/test_registration.py
+++ b/windriver/titanium_cloud/registration/tests/test_registration.py
@@ -48,7 +48,9 @@ MOCK_GET_FLAVOR_RESPONSE = {
MOCK_GET_FLAVOR_EXTRA_SPECS_RESPONSE = {
"extra_specs" : {
"aggregate_instance_extra_specs:storage" : "local_image",
- "capabilities:cpu_info:model" : "Haswell"
+ "capabilities:cpu_info:model" : "Haswell",
+ "hw:cpu_policy" : "dedicated",
+ "hw:cpu_thread_policy" : "prefer"
}
}
diff --git a/windriver/titanium_cloud/registration/views/registration.py b/windriver/titanium_cloud/registration/views/registration.py
index d735336c..8a21cb5c 100644
--- a/windriver/titanium_cloud/registration/views/registration.py
+++ b/windriver/titanium_cloud/registration/views/registration.py
@@ -40,7 +40,7 @@ class Registry(newton_registration.Registry):
cloud_owner, cloud_region_id = extsys.decode_vim_id(vimid)
for flavor in self._get_list_resources(
"/flavors/detail", "compute", session, viminfo, vimid,
- "flavors"):
+ "flavors"):
flavor_info = {
'flavor-id': flavor['id'],
'flavor-name': flavor['name'],
@@ -88,13 +88,19 @@ class Registry(newton_registration.Registry):
self._logger.debug("basic_capabilities_info: %s" % caps_dict)
hpa_caps.append(caps_dict)
+ # cpupining capabilities
+ caps_dict = self._get_cpupining_capabilities(extra_specs)
+ if len(caps_dict) > 0:
+ self._logger.debug("cpupining_capabilities_info: %s" % caps_dict)
+ hpa_caps.append(caps_dict)
+
return hpa_caps
def _get_hpa_basic_capabilities(self, flavor):
basic_capability = {}
feature_uuid = uuid.uuid4()
- basic_capability['hpaCapabilityID'] = str(feature_uuid)
+ basic_capability['hpaCapabilityID'] = str(feature_uuid)
basic_capability['hpaFeature'] = 'basicCapabilities'
basic_capability['hardwareArchitecture'] = 'generic'
basic_capability['version'] = 'v1'
@@ -107,3 +113,23 @@ class Registry(newton_registration.Registry):
return basic_capability
+ def _get_cpupining_capabilities(self, extra_specs):
+ cpupining_capability = {}
+ feature_uuid = uuid.uuid4()
+
+ if extra_specs.has_key('hw:cpu_policy') or extra_specs.has_key('hw:cpu_thread_policy'):
+ cpupining_capability['hpaCapabilityID'] = str(feature_uuid)
+ cpupining_capability['hpaFeature'] = 'cpuPining'
+ cpupining_capability['hardwareArchitecture'] = 'generic'
+ cpupining_capability['version'] = 'v1'
+
+ cpupining_capability['attributes'] = []
+ if extra_specs.has_key('hw:cpu_thread_policy'):
+ cpupining_capability['attributes'].append({'hpa-attribute-key': 'logicalCpuThreadPinningPolicy',
+ 'hpa-attribute-value':{'value': str(extra_specs['hw:cpu_thread_policy'])}})
+ if extra_specs.has_key('hw:cpu_policy'):
+ cpupining_capability['attributes'].append({'hpa-attribute-key':'logicalCpuPinningPolicy',
+ 'hpa-attribute-value': {'value':str(extra_specs['hw:cpu_policy'])}})
+
+ return cpupining_capability
+