summaryrefslogtreecommitdiffstats
path: root/windriver/titanium_cloud
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-03-26 15:25:30 +0800
committerYun Huang <yun.huang@windriver.com>2018-03-26 15:25:30 +0800
commite9eb1984964547edd7dee2cdb7a13e66c7b25548 (patch)
tree4449fc0781648f954f1b186e111f39e6d3d3f622 /windriver/titanium_cloud
parent5b0f340dcdacdaa868daf3327b7f51788905ef1f (diff)
Add HPA storage capabilities for TC
Change-Id: I5cdaf4c0f1e53d92879037f1826a51060e4aa7fc 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/views/registration.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/windriver/titanium_cloud/registration/views/registration.py b/windriver/titanium_cloud/registration/views/registration.py
index 59245c9c..c47a75d5 100644
--- a/windriver/titanium_cloud/registration/views/registration.py
+++ b/windriver/titanium_cloud/registration/views/registration.py
@@ -112,6 +112,12 @@ class Registry(newton_registration.Registry):
self._logger.debug("numa_capabilities_info: %s" % caps_dict)
hpa_caps.append(caps_dict)
+ # storage capabilities
+ caps_dict = self._get_storage_capabilities(flavor)
+ if len(caps_dict) > 0:
+ self._logger.debug("storage_capabilities_info: %s" % caps_dict)
+ hpa_caps.append(caps_dict)
+
return hpa_caps
def _get_hpa_basic_capabilities(self, flavor):
@@ -217,3 +223,20 @@ class Registry(newton_registration.Registry):
return numa_capability
+ def _get_storage_capabilities(self, flavor):
+ storage_capability = {}
+ feature_uuid = uuid.uuid4()
+
+ storage_capability['hpaCapabilityID'] = str(feature_uuid)
+ storage_capability['hpaFeature'] = 'localStorage'
+ storage_capability['hardwareArchitecture'] = 'generic'
+ storage_capability['version'] = 'v1'
+
+ storage_capability['attributes'] = []
+ storage_capability['attributes'].append({'hpa-attribute-key': 'diskSize',
+ 'hpa-attribute-value':{'value': str(flavor['disk']), 'unit':'GB'}})
+ storage_capability['attributes'].append({'hpa-attribute-key': 'swapMemSize',
+ 'hpa-attribute-value':{'value': str(flavor['swap']), 'unit':'MB'}})
+ storage_capability['attributes'].append({'hpa-attribute-key': 'ephemeralDiskSize',
+ 'hpa-attribute-value':{'value': str(flavor['OS-FLV-EXT-DATA:ephemeral']), 'unit':'GB'}})
+ return storage_capability