Fix HPA memorypagesize unit issue for windriver 67/43867/1
authorYun Huang <yun.huang@windriver.com>
Fri, 20 Apr 2018 07:04:40 +0000 (15:04 +0800)
committerYun Huang <yun.huang@windriver.com>
Fri, 20 Apr 2018 07:06:06 +0000 (15:06 +0800)
Change-Id: I5914d5d76d3556ba7be9eaf012d2eecf1db15d9a
Issue-ID: MULTICLOUD-206
Signed-off-by: Yun Huang <yun.huang@windriver.com>
windriver/titanium_cloud/registration/views/registration.py

index b3b2f00..de2dd33 100644 (file)
@@ -210,8 +210,20 @@ class Registry(newton_registration.Registry):
             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'])}})
+            if extra_specs['hw:mem_page_size'] == 'large':
+                hugepages_capability['attributes'].append({'hpa-attribute-key': 'memoryPageSize',
+                                                           'hpa-attribute-value':{'value': '2',
+                                                                                   'unit': 'MB'}})
+            elif extra_specs['hw:mem_page_size'] == 'small':
+                hugepages_capability['attributes'].append({'hpa-attribute-key': 'memoryPageSize',
+                                                           'hpa-attribute-value':{'value': '4',
+                                                                                   'unit': 'KB'}})
+            elif extra_specs['hw:mem_page_size'] == 'any':
+                self._logger.info("Currently HPA feature memoryPageSize did not support 'any' page!!")
+            else :
+                hugepages_capability['attributes'].append({'hpa-attribute-key': 'memoryPageSize',
+                                                           'hpa-attribute-value':{'value': str(extra_specs['hw:mem_page_size']),
+                                                                                   'unit': 'KB'}})
         return hugepages_capability
 
     def _get_numa_capabilities(self, extra_specs):