diff options
author | Yun Huang <yun.huang@windriver.com> | 2018-03-26 13:48:41 +0800 |
---|---|---|
committer | Yun Huang <yun.huang@windriver.com> | 2018-03-26 13:51:08 +0800 |
commit | 071f76e3c8ec51a6c03a48e1e83fd668c0206fef (patch) | |
tree | 73c9452ea40adb3d11a34f30bceffca332052380 | |
parent | d321a81cfd94b45f18bde96fef184bd9ac9e8be3 (diff) |
Add HPA huge pages capabilities for TC
Change-Id: I023cdfd3023a48ef7a036942486bedc9c9940701
Issue-ID: MULTICLOUD-200
Signed-off-by: Yun Huang <yun.huang@windriver.com>
-rw-r--r-- | windriver/titanium_cloud/registration/tests/test_registration.py | 3 | ||||
-rw-r--r-- | windriver/titanium_cloud/registration/views/registration.py | 20 |
2 files changed, 22 insertions, 1 deletions
diff --git a/windriver/titanium_cloud/registration/tests/test_registration.py b/windriver/titanium_cloud/registration/tests/test_registration.py index 53e8a47b..231a4358 100644 --- a/windriver/titanium_cloud/registration/tests/test_registration.py +++ b/windriver/titanium_cloud/registration/tests/test_registration.py @@ -53,7 +53,8 @@ MOCK_GET_FLAVOR_EXTRA_SPECS_RESPONSE = { "hw:cpu_thread_policy" : "prefer", "hw:cpu_sockets" : "2", "hw:cpu_cores" : "4", - "hw:cpu_threads" : "16" + "hw:cpu_threads" : "16", + "hw:mem_page_size" : "large" } } diff --git a/windriver/titanium_cloud/registration/views/registration.py b/windriver/titanium_cloud/registration/views/registration.py index c2d2f07a..7fce48a6 100644 --- a/windriver/titanium_cloud/registration/views/registration.py +++ b/windriver/titanium_cloud/registration/views/registration.py @@ -100,6 +100,12 @@ class Registry(newton_registration.Registry): self._logger.debug("cputopology_capabilities_info: %s" % caps_dict) hpa_caps.append(caps_dict) + # hugepages capabilities + caps_dict = self._get_hugepages_capabilities(extra_specs) + if len(caps_dict) > 0: + self._logger.debug("hugepages_capabilities_info: %s" % caps_dict) + hpa_caps.append(caps_dict) + return hpa_caps def _get_hpa_basic_capabilities(self, flavor): @@ -162,3 +168,17 @@ class Registry(newton_registration.Registry): return cputopology_capability + def _get_hugepages_capabilities(self, extra_specs): + hugepages_capability = {} + feature_uuid = uuid.uuid4() + + if extra_specs.has_key('hw:mem_page_size'): + hugepages_capability['hpaCapabilityID'] = str(feature_uuid) + hugepages_capability['hpaFeature'] = 'hugePages' + hugepages_capability['hardwareArchitecture'] = 'generic' + hugepages_capability['version'] = 'v1' + + hugepages_capability['attributes'] = [] + hugepages_capability['attributes'].append({'hpa-attribute-key': 'memoryPageSize', + 'hpa-attribute-value':{'value': str(extra_specs['hw:mem_page_size'])}}) + return hugepages_capability |