Fix hpa registration cloud_extra_info format 53/47353/1
authorHaibin Huang <haibin.huang@intel.com>
Mon, 14 May 2018 08:38:33 +0000 (16:38 +0800)
committerHaibin Huang <haibin.huang@intel.com>
Mon, 14 May 2018 08:42:17 +0000 (16:42 +0800)
Change-Id: Ie597bc2b93a7538138558a38b33e1014c2364687
Issue-ID: MULTICLOUD-206
Signed-off-by: Haibin Huang <haibin.huang@intel.com>
ocata/ocata/registration/views/registration.py

index 4d954cb..bb89899 100644 (file)
@@ -318,6 +318,13 @@ class Registry(newton_registration.Registry):
         feature_uuid = uuid.uuid4()
 
         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 :