summaryrefslogtreecommitdiffstats
path: root/windriver/titanium_cloud
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-03-26 14:49:55 +0800
committerYun Huang <yun.huang@windriver.com>2018-03-26 14:49:55 +0800
commit5b0f340dcdacdaa868daf3327b7f51788905ef1f (patch)
tree1e1597cea0e0cf5f52ac348a604193d1494b366b /windriver/titanium_cloud
parent071f76e3c8ec51a6c03a48e1e83fd668c0206fef (diff)
Add HPA NUMA capabilities for TC
Change-Id: I9f8a3eecde4887e9cf2a63d3370cd1b8d4bfd3d1 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/tests/test_registration.py8
-rw-r--r--windriver/titanium_cloud/registration/views/registration.py35
2 files changed, 42 insertions, 1 deletions
diff --git a/windriver/titanium_cloud/registration/tests/test_registration.py b/windriver/titanium_cloud/registration/tests/test_registration.py
index 231a4358..bf192444 100644
--- a/windriver/titanium_cloud/registration/tests/test_registration.py
+++ b/windriver/titanium_cloud/registration/tests/test_registration.py
@@ -54,7 +54,13 @@ MOCK_GET_FLAVOR_EXTRA_SPECS_RESPONSE = {
"hw:cpu_sockets" : "2",
"hw:cpu_cores" : "4",
"hw:cpu_threads" : "16",
- "hw:mem_page_size" : "large"
+ "hw:mem_page_size" : "large",
+ "hw:numa_nodes" : "2",
+ "hw:numa_cpus.0" : "0,1",
+ "hw:numa_cpus.1" : "2,3,4,5",
+ "hw:numa_mem.0" : "2048",
+ "hw:numa_mem.1" : "2048"
+
}
}
diff --git a/windriver/titanium_cloud/registration/views/registration.py b/windriver/titanium_cloud/registration/views/registration.py
index 7fce48a6..59245c9c 100644
--- a/windriver/titanium_cloud/registration/views/registration.py
+++ b/windriver/titanium_cloud/registration/views/registration.py
@@ -106,6 +106,12 @@ class Registry(newton_registration.Registry):
self._logger.debug("hugepages_capabilities_info: %s" % caps_dict)
hpa_caps.append(caps_dict)
+ # numa capabilities
+ caps_dict = self._get_numa_capabilities(extra_specs)
+ if len(caps_dict) > 0:
+ self._logger.debug("numa_capabilities_info: %s" % caps_dict)
+ hpa_caps.append(caps_dict)
+
return hpa_caps
def _get_hpa_basic_capabilities(self, flavor):
@@ -182,3 +188,32 @@ class Registry(newton_registration.Registry):
hugepages_capability['attributes'].append({'hpa-attribute-key': 'memoryPageSize',
'hpa-attribute-value':{'value': str(extra_specs['hw:mem_page_size'])}})
return hugepages_capability
+
+ def _get_numa_capabilities(self, extra_specs):
+ numa_capability = {}
+ feature_uuid = uuid.uuid4()
+
+ if extra_specs.has_key('hw:numa_nodes'):
+ numa_capability['hpaCapabilityID'] = str(feature_uuid)
+ numa_capability['hpaFeature'] = 'numa'
+ numa_capability['hardwareArchitecture'] = 'generic'
+ numa_capability['version'] = 'v1'
+
+ numa_capability['attributes'] = []
+ numa_capability['attributes'].append({'hpa-attribute-key': 'numaNodes',
+ 'hpa-attribute-value':{'value': str(extra_specs['hw:numa_nodes'])}})
+
+ for num in range(0, int(extra_specs['hw:numa_nodes'])):
+ numa_cpu_node = "hw:numa_cpus.%s" % num
+ numa_mem_node = "hw:numa_mem.%s" % num
+ numacpu_key = "numaCpu-%s" % num
+ numamem_key = "numaMem-%s" % num
+
+ if extra_specs.has_key(numa_cpu_node) and extra_specs.has_key(numa_mem_node):
+ numa_capability['attributes'].append({'hpa-attribute-key': numacpu_key,
+ 'hpa-attribute-value':{'value': str(extra_specs[numa_cpu_node])}})
+ numa_capability['attributes'].append({'hpa-attribute-key': numamem_key,
+ 'hpa-attribute-value':{'value': str(extra_specs[numa_mem_node]),'unit':'MB'}})
+
+ return numa_capability
+