Logging enhancement for base registeration 87/45087/1
authorYun Huang <yun.huang@windriver.com>
Fri, 27 Apr 2018 10:30:42 +0000 (18:30 +0800)
committerYun Huang <yun.huang@windriver.com>
Fri, 27 Apr 2018 10:30:42 +0000 (18:30 +0800)
Change-Id: I5aad3f0b8738a6b922720a776ec05425080e6f4c
Issue-ID: MULTICLOUD-178
Signed-off-by: Yun Huang <yun.huang@windriver.com>
share/newton_base/registration/registration.py

index 7513fd7..ecf613b 100644 (file)
@@ -42,12 +42,14 @@ class Registry(APIView):
         service = {'service_type': service_type,
                    'interface': 'public',
                    'region_id': viminfo['cloud_region_id']}
+        logger.info("making request with URI:%s" % resource_url)
         resp = session.get(resource_url, endpoint_filter=service)
+        logger.info("request returns with status %s" % resp.status_code)
+        if resp.status_code == status.HTTP_200_OK:
+            logger.debug("with content:%s" % resp.json())
+            pass
         content = resp.json()
 
-        self._logger.debug("vimid: %s, req: %s,resp code: %s, body: %s"
-                           % (vimid, resource_url, resp.status_code,content))
-
         if resp.status_code != status.HTTP_200_OK:
             return  # failed to discover resources
         return content.get(content_key)
@@ -230,11 +232,14 @@ class Registry(APIView):
                     service = {'service_type': "image",
                                'interface': 'public',
                                'region_id': viminfo['cloud_region_id']}
+                    logger.info("making request with URI:%s" % req_resource)
                     resp = session.get(req_resource, endpoint_filter=service)
+                    logger.info("request returns with status %s" % resp.status_code)
+                    if resp.status_code == status.HTTP_200_OK:
+                        logger.debug("with content:%s" % resp.json())
+                        pass
                     content = resp.json()
 
-                    self._logger.debug("vimid: %s, req: %s,resp code: %s, body: %s"
-                                       % (vimid, req_resource, resp.status_code, content))
                     # if resp.status_code == status.HTTP_200_OK:
                         # parse the schema? TBD
                         # self.update_image(cloud_owner, cloud_region_id, image_info)
@@ -270,10 +275,13 @@ class Registry(APIView):
                         service = {'service_type': "compute",
                                    'interface': 'public',
                                    'region_id': viminfo['cloud_region_id']}
+                        logger.info("making request with URI:%s" % req_resource)
                         resp = session.get(req_resource, endpoint_filter=service)
+                        logger.info("request returns with status %s" % resp.status_code)
+                        if resp.status_code == status.HTTP_200_OK:
+                            logger.debug("with content:%s" % resp.json())
+                            pass
                         content = resp.json()
-                        self._logger.debug("vimid: %s, req: %s,resp code: %s, body: %s"
-                                           % (vimid, req_resource, resp.status_code, content))
                         if resp.status_code != status.HTTP_200_OK and not content[0]:
                             continue
                         az_info['hypervisor-type'] = content['hypervisors'][0]['hypervisor_type']\