Fix limit API bug
authorBin Yang <bin.yang@windriver.com>
Mon, 27 Mar 2017 02:56:38 +0000 (10:56 +0800)
committerBin Yang <bin.yang@windriver.com>
Mon, 27 Mar 2017 02:56:38 +0000 (10:56 +0800)
Change-Id: I1d88ea7e2a7b7ffbeab6a39afc8920a820df3586
Issue-Id: MULTIVIM-54
Signed-off-by: Bin Yang <bin.yang@windriver.com>
kilo/kilo/requests/views/limits.py
kilo/kilo/swagger/multivim.network.swagger.json
newton/newton/requests/views/limits.py
newton/newton/swagger/multivim.network.swagger.json

index 2cddfb4..fce584f 100644 (file)
@@ -34,6 +34,10 @@ class Limits(APIView):
                'interface': 'public',
                'region_name': 'RegionOne'}
 
+    service_volume = {'service_type': 'volumev2',
+               'interface': 'public',
+               'region_name': 'RegionOne'}
+
     def get(self, request, vimid="", tenantid=""):
         logger.debug("Limits--get::> %s" % request.data)
         try:
@@ -60,6 +64,13 @@ class Limits(APIView):
             content = resp.json()
             content_all.update(content['quota'])
 
+            #now get volume limits
+            # prepare request resource to vim instance
+            req_resouce = "/limits"
+            resp = sess.get(req_resouce, endpoint_filter=self.service_volume)
+            content = resp.json()
+            content_all.update(content['limits']['absolute'])
+
             return Response(data=content_all, status=resp.status_code)
         except VimDriverKiloException as e:
             return Response(data={'error': e.content}, status=e.status_code)
index 92794d6..fb8524b 100644 (file)
@@ -51,7 +51,7 @@
                     }
                 ],
                 "responses": {
-                    "200": {
+                    "201": {
                         "description": "successful operation",
                         "schema": {
                             "$ref": "#/definitions/VimNetworkInfo"
index 16c7f72..33e4af3 100644 (file)
@@ -34,6 +34,10 @@ class Limits(APIView):
                'interface': 'public',
                'region_name': 'RegionOne'}
 
+    service_volume = {'service_type': 'volumev2',
+               'interface': 'public',
+               'region_name': 'RegionOne'}
+
     def get(self, request, vimid="", tenantid=""):
         logger.debug("Limits--get::> %s" % request.data)
         try:
@@ -60,6 +64,13 @@ class Limits(APIView):
             content = resp.json()
             content_all.update(content['quota'])
 
+            #now get volume limits
+            # prepare request resource to vim instance
+            req_resouce = "/limits"
+            resp = sess.get(req_resouce, endpoint_filter=self.service_volume)
+            content = resp.json()
+            content_all.update(content['limits']['absolute'])
+
             return Response(data=content_all, status=resp.status_code)
         except VimDriverNewtonException as e:
             return Response(data={'error': e.content}, status=e.status_code)
index 92794d6..fb8524b 100644 (file)
@@ -51,7 +51,7 @@
                     }
                 ],
                 "responses": {
-                    "200": {
+                    "201": {
                         "description": "successful operation",
                         "schema": {
                             "$ref": "#/definitions/VimNetworkInfo"