Fix HPA memorypagesize unit issue for ocata 55/43855/1
authorYun Huang <yun.huang@windriver.com>
Fri, 20 Apr 2018 06:17:09 +0000 (14:17 +0800)
committerYun Huang <yun.huang@windriver.com>
Fri, 20 Apr 2018 06:20:44 +0000 (14:20 +0800)
Change-Id: I5f5d50720b0e4e81cbe22c77499c00a862d639ad
Issue-ID: MULTICLOUD-206
Signed-off-by: Yun Huang <yun.huang@windriver.com>
ocata/ocata/registration/views/registration.py

index 25ec0db..4dd8767 100644 (file)
@@ -211,8 +211,21 @@ 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):