From 8a033231ae6341745cd4a5b12422f10c261c5c2f Mon Sep 17 00:00:00 2001 From: Yun Huang Date: Fri, 27 Apr 2018 18:30:42 +0800 Subject: Logging enhancement for base registeration Change-Id: I5aad3f0b8738a6b922720a776ec05425080e6f4c Issue-ID: MULTICLOUD-178 Signed-off-by: Yun Huang --- share/newton_base/registration/registration.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'share/newton_base') diff --git a/share/newton_base/registration/registration.py b/share/newton_base/registration/registration.py index 7513fd79..ecf613b8 100644 --- a/share/newton_base/registration/registration.py +++ b/share/newton_base/registration/registration.py @@ -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']\ -- cgit 1.2.3-korg