summaryrefslogtreecommitdiffstats
path: root/share/newton_base/registration/registration.py
diff options
context:
space:
mode:
authorHuang Haibin <haibin.huang@intel.com>2018-08-29 15:54:41 +0800
committerHuang Haibin <haibin.huang@intel.com>2018-09-03 16:37:57 +0800
commit1c1c3ee7fd7045ce52f1a32ea239353263a31f81 (patch)
tree3ff49de2a89b1cbd55ce283f2f4ada44063d9726 /share/newton_base/registration/registration.py
parent0ac4f904fae7793a3909f6db34ad9b3c35a08c12 (diff)
Add registration OvS-DPDK
We need to manualy register information of OvS-DPDK to AAI in ESR system. Then we can get Ovs-DPDK from AAI and use it. Change-Id: I4ada7192e2364b2d0f7667ff59d80d413db7bdad Issue-ID: MULTICLOUD-251 Signed-off-by: Huang Haibin <haibin.huang@intel.com>
Diffstat (limited to 'share/newton_base/registration/registration.py')
-rw-r--r--share/newton_base/registration/registration.py42
1 files changed, 27 insertions, 15 deletions
diff --git a/share/newton_base/registration/registration.py b/share/newton_base/registration/registration.py
index ff6bfd50..0a5f5e55 100644
--- a/share/newton_base/registration/registration.py
+++ b/share/newton_base/registration/registration.py
@@ -183,7 +183,7 @@ class Registry(APIView):
req_resouce = "/flavors/%s/os-extra_specs" % flavor['id']
extraResp = self._get_list_resources(req_resouce, "compute", session, viminfo, vimid, "extra_specs")
- hpa_capabilities = self._get_hpa_capabilities(flavor, extraResp)
+ hpa_capabilities = self._get_hpa_capabilities(flavor, extraResp, viminfo)
flavor_info['hpa-capabilities'] = {'hpa-capability': hpa_capabilities}
self._update_resoure(
@@ -200,7 +200,7 @@ class Registry(APIView):
self._logger.error(traceback.format_exc())
return
- def _get_hpa_capabilities(self, flavor, extra_specs):
+ def _get_hpa_capabilities(self, flavor, extra_specs, viminfo):
hpa_caps = []
# Basic capabilties
@@ -238,13 +238,13 @@ class Registry(APIView):
if len(caps_dict) > 0:
self._logger.debug("storage_capabilities_info: %s" % caps_dict)
hpa_caps.append(caps_dict)
-
+
# CPU instruction set extension capabilities
caps_dict = self._get_instruction_set_capabilities(extra_specs)
if len(caps_dict) > 0:
self._logger.debug("instruction_set_capabilities_info: %s" % caps_dict)
hpa_caps.append(caps_dict)
-
+
# PCI passthrough capabilities
caps_dict = self._get_pci_passthrough_capabilities(extra_specs)
if len(caps_dict) > 0:
@@ -252,7 +252,7 @@ class Registry(APIView):
hpa_caps.append(caps_dict)
# ovsdpdk capabilities
- caps_dict = self._get_ovsdpdk_capabilities(extra_specs)
+ caps_dict = self._get_ovsdpdk_capabilities(extra_specs, viminfo)
if len(caps_dict) > 0:
self._logger.debug("ovsdpdk_capabilities_info: %s" % caps_dict)
hpa_caps.append(caps_dict)
@@ -468,20 +468,32 @@ class Registry(APIView):
return pci_passthrough_capability
- def _get_ovsdpdk_capabilities(self, extra_specs):
+ def _get_ovsdpdk_capabilities(self, extra_specs, viminfo):
ovsdpdk_capability = {}
feature_uuid = uuid.uuid4()
- ovsdpdk_capability['hpa-capability-id'] = str(feature_uuid)
- ovsdpdk_capability['hpa-feature'] = 'ovsDpdk'
- ovsdpdk_capability['architecture'] = 'Intel64'
- ovsdpdk_capability['hpa-version'] = 'v1'
+ cloud_extra_info_str = viminfo.get('cloud_extra_info')
+ if not isinstance(cloud_extra_info_str, dict):
+ try:
+ cloud_extra_info_str = json.loads(cloud_extra_info_str)
+ except Exception as ex:
+ logger.error("Can not convert cloud extra info %s %s" % (
+ str(ex), cloud_extra_info_str))
+ return {}
+ if cloud_extra_info_str :
+ cloud_dpdk_info = cloud_extra_info_str.get("ovsDpdk")
+ if cloud_dpdk_info :
+ ovsdpdk_capability['hpa-capability-id'] = str(feature_uuid)
+ ovsdpdk_capability['hpa-feature'] = 'ovsDpdk'
+ ovsdpdk_capability['architecture'] = 'Intel64'
+ ovsdpdk_capability['hpa-version'] = 'v1'
+
+ ovsdpdk_capability['hpa-feature-attributes'] = [
+ {
+ 'hpa-attribute-key': str(cloud_dpdk_info.get("libname")),
+ 'hpa-attribute-value': '{{\"value\":\"{0}\"}}'.format(cloud_dpdk_info.get("libversion"))
+ },]
- ovsdpdk_capability['hpa-feature-attributes'] = []
- ovsdpdk_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'dataProcessingAccelerationLibrary',
- 'hpa-attribute-value':
- '{{\"value\":\"{0}\"}}'.format("v17.02")
- })
return ovsdpdk_capability
# def update_image_metadata(self, cloud_owner, cloud_region_id, image_id, metadatainfo):