From 70465cfc742890d76a6333ffd31d5e343a6a6873 Mon Sep 17 00:00:00 2001 From: Yun Huang Date: Fri, 27 Apr 2018 14:25:30 +0800 Subject: Logging enhancement for openo tenants API Change-Id: I1ba5dd5a6da3ee52b7499d46cfc9f0d13e36a9a0 Issue-ID: MULTICLOUD-178 Signed-off-by: Yun Huang --- share/newton_base/openoapi/tenants.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'share/newton_base/openoapi') diff --git a/share/newton_base/openoapi/tenants.py b/share/newton_base/openoapi/tenants.py index 926f72c5..db5cc8a8 100644 --- a/share/newton_base/openoapi/tenants.py +++ b/share/newton_base/openoapi/tenants.py @@ -37,7 +37,10 @@ class Tenants(APIView): ] def get(self, request, vimid=""): - logger.debug("Tenants--get::> %s" % request.data) + logger.info("vimid = %s" % vimid) + if request.data: + logger.debug("With data = %s" % request.data) + pass try: #prepare request resource to vim instance query = VimDriverUtils.get_query_part(request) @@ -48,7 +51,13 @@ class Tenants(APIView): req_resouce = "/v2.0/tenants" sess = VimDriverUtils.get_session(vim) + logger.info("making request with URI:%s" % req_resouce) resp = sess.get(req_resouce, endpoint_filter=self.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() vim_dict = { "vimName": vim["name"], @@ -68,9 +77,10 @@ class Tenants(APIView): for tenant in tmp: if tenantname == tenant['name']: content["tenants"].append(tenant) - + logger.info("response with status = %s" % resp.status_code) return Response(data=content, status=resp.status_code) except VimDriverNewtonException as e: + logger.error("response with status = %s" % e.status_code) return Response( data={'error': e.content}, status=e.status_code) except HttpError as e: -- cgit 1.2.3-korg