diff options
author | Bin Hu <bh526r@att.com> | 2018-03-28 04:51:01 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-28 04:51:01 +0000 |
commit | da79499c4dff19bf230c751ac564f7f2b41f4373 (patch) | |
tree | 425379d04e1a479de20d6431edd15b5b29d517a7 | |
parent | 88c16f1784844768692856c6a57583e6aa127391 (diff) | |
parent | 8c3a4a8fefd38b48829badf91d12f8c8aa80021f (diff) |
Merge "Fix bug of capacity_check for ocata"
-rw-r--r-- | ocata/ocata/resource/views/capacity.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ocata/ocata/resource/views/capacity.py b/ocata/ocata/resource/views/capacity.py index d73cc0fb..8ea37062 100644 --- a/ocata/ocata/resource/views/capacity.py +++ b/ocata/ocata/resource/views/capacity.py @@ -77,20 +77,20 @@ class CapacityCheck(APIView): # compute actual available resource for this tenant remainVCPU = compute_limits['maxTotalCores'] - compute_limits['totalCoresUsed'] + remainHypervisorVCPU = hypervisor_statistics['vcpus'] - hypervisor_statistics['vcpus_used'] - if (compute_limits['maxTotalCores'] > hypervisor_statistics['vcpus']): - if hypervisor_statistics['vcpus'] > compute_limits['totalCoresUsed']: - remainVCPU = hypervisor_statistics['vcpus'] - compute_limits['totalCoresUsed'] - else: - remainVCPU = 0 + if (remainVCPU > remainHypervisorVCPU): + remainVCPU = remainHypervisorVCPU remainMEM = compute_limits['maxTotalRAMSize'] - compute_limits['totalRAMUsed'] - if hypervisor_statistics['free_ram_mb'] > remainMEM: - remainMEM = hypervisor_statistics['free_ram_mb'] + remainHypervisorMEM = hypervisor_statistics['free_ram_mb'] + if remainMEM > remainHypervisorMEM: + remainMEM = remainHypervisorMEM remainStorage = storage_limits['maxTotalVolumeGigabytes'] - storage_limits['totalGigabytesUsed'] - if (remainStorage < hypervisor_statistics['free_disk_gb']): - remainStorage = hypervisor_statistics['free_disk_gb'] + remainHypervisorStorage = hypervisor_statistics['free_disk_gb'] + if (remainStorage > remainHypervisorStorage): + remainStorage = remainHypervisorStorage # compare resource demanded with available if (int(resource_demand['vCPU']) >= remainVCPU): |