From 3d4e63ece641b06f5093473bc7f22013ecc9c97c Mon Sep 17 00:00:00 2001 From: Yun Huang Date: Mon, 19 Mar 2018 23:26:34 +0800 Subject: ADD UT for capacity check successfully Change-Id: Ie9684d68991b401572a6712d9771ce9dd60d5778 Issue-ID: MULTICLOUD-168 Signed-off-by: Yun Huang --- windriver/titanium_cloud/resource/views/capacity.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'windriver/titanium_cloud/resource/views/capacity.py') 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 -- cgit 1.2.3-korg