summaryrefslogtreecommitdiffstats
path: root/windriver/titanium_cloud/resource/views
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-03-19 23:26:34 +0800
committerYun Huang <yun.huang@windriver.com>2018-03-19 23:29:48 +0800
commit3d4e63ece641b06f5093473bc7f22013ecc9c97c (patch)
treee3cad1147feabd26addf2f22e610bff7f40499ab /windriver/titanium_cloud/resource/views
parent020650684672fdbb992a9256695aaf36205fd4f3 (diff)
ADD UT for capacity check successfully
Change-Id: Ie9684d68991b401572a6712d9771ce9dd60d5778 Issue-ID: MULTICLOUD-168 Signed-off-by: Yun Huang <yun.huang@windriver.com>
Diffstat (limited to 'windriver/titanium_cloud/resource/views')
-rw-r--r--windriver/titanium_cloud/resource/views/capacity.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/windriver/titanium_cloud/resource/views/capacity.py b/windriver/titanium_cloud/resource/views/capacity.py
index 6d20075c..d73cc0fb 100644
--- a/windriver/titanium_cloud/resource/views/capacity.py
+++ b/windriver/titanium_cloud/resource/views/capacity.py
@@ -43,7 +43,7 @@ class CapacityCheck(APIView):
hasEnoughResource = False
try :
- resource_demand = json.load(request.data)
+ resource_demand = request.data
#get token:
cloud_owner, regionid = extsys.decode_vim_id(vimid)
@@ -93,11 +93,11 @@ class CapacityCheck(APIView):
remainStorage = hypervisor_statistics['free_disk_gb']
# compare resource demanded with available
- if (resource_demand['vCPU'] >= remainVCPU):
+ if (int(resource_demand['vCPU']) >= remainVCPU):
hasEnoughResource = False
- elif (resource_demand['Memory'] >= remainMEM):
+ elif (int(resource_demand['Memory']) >= remainMEM):
hasEnoughResource = False
- elif (resource_demand['Storage'] >= remainStorage):
+ elif (int(resource_demand['Storage']) >= remainStorage):
hasEnoughResource = False
else:
hasEnoughResource = True