summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang Haibin <haibin.huang@intel.com>2018-10-15 15:13:52 +0800
committerHuang Haibin <haibin.huang@intel.com>2018-10-15 15:24:24 +0800
commitd80174a3231e97be691f916e612933696de27ef5 (patch)
tree91939daceed09d2a17c81f11ea56a734cd72fa80
parentc7c2c8ac37599655d114a500dfc00aee5d06b48a (diff)
Upgrade capacity v1 for pike
Change-Id: Ifd7e13b273550d7722f2213ab788d467870b6875 Issue-ID: MULTICLOUD-377 Signed-off-by: Huang Haibin <haibin.huang@intel.com>
-rw-r--r--pike/pike/resource/views/capacity.py13
-rw-r--r--pike/pike/urls.py2
2 files changed, 15 insertions, 0 deletions
diff --git a/pike/pike/resource/views/capacity.py b/pike/pike/resource/views/capacity.py
index c3bdc943..475ccdf7 100644
--- a/pike/pike/resource/views/capacity.py
+++ b/pike/pike/resource/views/capacity.py
@@ -134,3 +134,16 @@ class CapacityCheck(APIView):
return Response(data={'result': hasEnoughResource, 'error': str(e)},
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+class APIv1CapacityCheck(CapacityCheck):
+
+ def __init__(self):
+ super(APIv1CapacityCheck, self).__init__()
+ # self._logger = logger
+
+ def post(self, request, cloud_owner="", cloud_region_id=""):
+ self._logger.info("vimid, data> %s,%s, %s" % (cloud_owner, cloud_region_id, request.data))
+ self._logger.debug("META> %s" % request.META)
+
+ vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id)
+ return super(APIv1CapacityCheck, self).post(request, vimid)
+
diff --git a/pike/pike/urls.py b/pike/pike/urls.py
index f6b57fa4..024b5a36 100644
--- a/pike/pike/urls.py
+++ b/pike/pike/urls.py
@@ -48,6 +48,8 @@ urlpatterns = [
tenants.APIv1Tenants.as_view()),
url(r'^api/multicloud-pike/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/'
'(?P<tenantid>[0-9a-zA-Z_-]{20,})/', include('pike.requests.urlsV1')),
+ url(r'^api/multicloud-pike/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/capacity_check/?$',
+ capacity.APIv1CapacityCheck.as_view()),
url(r'^api/multicloud-pike/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/infra_workload/?$',
infra_workload.APIv1InfraWorkload.as_view()),