From e9eb1984964547edd7dee2cdb7a13e66c7b25548 Mon Sep 17 00:00:00 2001 From: Yun Huang Date: Mon, 26 Mar 2018 15:25:30 +0800 Subject: Add HPA storage capabilities for TC Change-Id: I5cdaf4c0f1e53d92879037f1826a51060e4aa7fc Issue-ID: MULTICLOUD-200 Signed-off-by: Yun Huang --- .../registration/views/registration.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'windriver/titanium_cloud') 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 -- cgit 1.2.3-korg