diff options
author | Nate Potter <nathaniel.potteR@intel.com> | 2018-03-27 03:02:35 -0700 |
---|---|---|
committer | Nate Potter <Nathaniel.Potter@intel.com> | 2018-03-27 17:18:03 +0000 |
commit | 905a7229938fe3914db8f62af70c5d798542bfe2 (patch) | |
tree | 3710324e343d87da01bd291b0da92b9871e2b558 | |
parent | ec35e070f380d2188fca9305f1bbe3375ae6cd6f (diff) |
Add OVS DPDK HPA to Newton
This commit adds OVS DPDK HPA discovery to flavor fetching
in Newton.
Change-Id: Id36145f47b8c2f6d636d38b645b5720493734f8d
Signed-off-by: Nathaniel Potter <nathaniel.potter@intel.com>
Issue-ID: MULTICLOUD-179
-rw-r--r-- | newton/newton/registration/views/hpa.json | 6 | ||||
-rw-r--r-- | newton/newton/registration/views/registration.py | 25 |
2 files changed, 29 insertions, 2 deletions
diff --git a/newton/newton/registration/views/hpa.json b/newton/newton/registration/views/hpa.json index 832d55af..2f87d21e 100644 --- a/newton/newton/registration/views/hpa.json +++ b/newton/newton/registration/views/hpa.json @@ -125,5 +125,11 @@ "unit": null } } + }, + "ovsDpdk": { + "info": { + "hpa-feature": "ovsDpdk", + "hpa-version": "v1" + } } } diff --git a/newton/newton/registration/views/registration.py b/newton/newton/registration/views/registration.py index f07428a1..85419d27 100644 --- a/newton/newton/registration/views/registration.py +++ b/newton/newton/registration/views/registration.py @@ -38,6 +38,11 @@ class Registry(newton_registration.Registry): def _discover_flavors(self, vimid="", session=None, viminfo=None): try: cloud_owner, cloud_region_id = extsys.decode_vim_id(vimid) + cloud_extra_info_str = viminfo.get('cloud_extra_info') + if cloud_extra_info_str: + cloud_extra_info = json.loads(cloud_extra_info_str) + else: + cloud_extra_info = None for flavor in self._get_list_resources( "/flavors/detail", "compute", session, viminfo, vimid, "flavors"): @@ -61,7 +66,8 @@ class Registry(newton_registration.Registry): extraResp = Flavors._get_flavor_extra_specs(session, flavor['id']) extraContent = extraResp.json() hpa_capabilities = self._get_hpa_capabilities(vimid, flavor, - extraContent["extra_specs"]) + extraContent["extra_specs"], + cloud_extra_info) flavor_info['hpa_capabilities'] = hpa_capabilities self._update_resoure( @@ -78,7 +84,7 @@ class Registry(newton_registration.Registry): self._logger.error(traceback.format_exc()) return - def _get_hpa_capabilities(self, vimid, flavor, extra_specs): + def _get_hpa_capabilities(self, vimid, flavor, extra_specs, cloud_extra_info): """Convert flavor information to HPA capabilities for AAI""" cloud_owner, cloud_region_id = extsys.decode_vim_id(vimid) @@ -194,6 +200,21 @@ class Registry(newton_registration.Registry): capability['hpa-features-attributes'] = attributes capabilities.append(capability) + # OVS DPDK + if cloud_extra_info: + cloud_dpdk_info = cloud_extra_info.get('ovsDpdk') + capability = hpa_dict['ovsDpdk']['info'] + capability['hpa-capability-id'] = str(uuid.uuid4()) + capability['hardwareArchitecture'] = cloud_dpdk_info.get('arch') + attributes = [ + { + 'hpa-attribute-key': cloud_dpdk_info.get('libname'), + 'hpa-attribute-value': '{{\"value\":\"{0}\"}}'.format(cloud_dpdk_info.get('libvalue')) + } + ] + capability['hpa-features-attributes'] = attributes + capabilities.append(capability) + return capabilities def _get_capability_attributes(self, cloud_info, attributes): |