summaryrefslogtreecommitdiffstats
path: root/windriver/titanium_cloud/registration/views
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/registration/views
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/registration/views')
-rw-r--r--windriver/titanium_cloud/registration/views/registration.py35
1 files changed, 35 insertions, 0 deletions
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
+