From abd7f8cac14a6873b11d70b68d909819b46ab184 Mon Sep 17 00:00:00 2001 From: Yun Huang Date: Tue, 5 Jun 2018 16:58:39 +0800 Subject: Fix check capacity exception for newton and ocata Change-Id: I6ed7722ee0a8e4148d9a0ed9414c736187bdedf3 Issue-ID: MULTICLOUD-168 Signed-off-by: Yun Huang --- windriver/titanium_cloud/resource/views/capacity.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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 0dde5994..6adb8785 100644 --- a/windriver/titanium_cloud/resource/views/capacity.py +++ b/windriver/titanium_cloud/resource/views/capacity.py @@ -78,9 +78,9 @@ class CapacityCheck(APIView): if e.http_status == status.HTTP_403_FORBIDDEN: # Due to non administrator account cannot get hypervisor data, # so construct enough resource data - conVCPUS = int(resource_demand['vCPU']) + 2 - conFreeRamMB = int(resource_demand['Memory']) + 2 - conFreeDiskGB = int(resource_demand['Storage']) + 2 + conVCPUS = int(resource_demand['vCPU']) + conFreeRamMB = int(resource_demand['Memory']) + conFreeDiskGB = int(resource_demand['Storage']) self._logger.info("Non administator forbidden to access hypervisor statistics data") hypervisor_statistics = {'vcpus_used':0, 'vcpus':conVCPUS, 'free_ram_mb':conFreeRamMB, 'free_disk_gb':conFreeDiskGB} else: @@ -115,11 +115,11 @@ class CapacityCheck(APIView): remainStorage = remainHypervisorStorage # compare resource demanded with available - if (int(resource_demand['vCPU']) >= remainVCPU): + if (int(resource_demand['vCPU']) > remainVCPU): hasEnoughResource = False - elif (int(resource_demand['Memory']) >= remainMEM): + elif (int(resource_demand['Memory']) > remainMEM): hasEnoughResource = False - elif (int(resource_demand['Storage']) >= remainStorage): + elif (int(resource_demand['Storage']) > remainStorage): hasEnoughResource = False else: hasEnoughResource = True -- cgit 1.2.3-korg