diff options
author | zhang ab <zhanganbing@chinamobile.com> | 2018-04-25 04:01:28 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-04-25 04:01:28 +0000 |
commit | b6a8ab058129069ddcf812f56b6c2877a9145c33 (patch) | |
tree | 4ded7db29b51463e14864f9c19cb0c513611042d /share/newton_base/openoapi | |
parent | dfb8ab23ab81f51f7fad515c75dcc44f03880d80 (diff) | |
parent | 6dc8fbafec041d0d45dc45d886ae46f0ac6a6339 (diff) |
Merge "Logging enhancement for openo limits API"
Diffstat (limited to 'share/newton_base/openoapi')
-rw-r--r-- | share/newton_base/openoapi/limits.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/share/newton_base/openoapi/limits.py b/share/newton_base/openoapi/limits.py index 3302fdba..f3ff42b6 100644 --- a/share/newton_base/openoapi/limits.py +++ b/share/newton_base/openoapi/limits.py @@ -37,14 +37,19 @@ class Limits(APIView): 'interface': 'public'} def get(self, request, vimid="", tenantid=""): - logger.debug("Limits--get::> %s" % request.data) + logger.info("vimid, tenantid = %s,%s" % (vimid, tenantid)) + if request.data: + logger.debug("With data = %s" % request.data) + pass try: #get limits first # prepare request resource to vim instance req_resouce = "/limits" vim = VimDriverUtils.get_vim_info(vimid) sess = VimDriverUtils.get_session(vim, tenantid) + 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) content = resp.json() content_all =content['limits']['absolute'] @@ -58,19 +63,24 @@ class Limits(APIView): #now get quota # prepare request resource to vim instance req_resouce = "/v2.0/quotas/%s" % tenantid + logger.info("making request with URI:%s" % req_resouce) resp = sess.get(req_resouce, endpoint_filter=self.service_network) + logger.info("request returns with status %s" % resp.status_code) content = resp.json() content_all.update(content['quota']) #now get volume limits # prepare request resource to vim instance req_resouce = "/limits" + logger.info("making request with URI:%s" % req_resouce) resp = sess.get(req_resouce, endpoint_filter=self.service_volume) + logger.info("request returns with status %s" % resp.status_code) content = resp.json() content_all.update(content['limits']['absolute']) return Response(data=content_all, 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: logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) |