You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ap...@apache.org on 2015/06/19 06:00:51 UTC
git commit: updated refs/heads/master to bcfb824
Repository: cloudstack
Updated Branches:
refs/heads/master 797a7f05f -> bcfb8240e
CLOUDSTACK-8570:Exception in calculating reserved capacity for dynamic service offering
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bcfb8240
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bcfb8240
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bcfb8240
Branch: refs/heads/master
Commit: bcfb8240e1521c9ac34ea93ae2c7b53c5803ec8a
Parents: 797a7f0
Author: Abhinandan Prateek <ab...@shapeblue.com>
Authored: Fri Jun 19 09:24:56 2015 +0530
Committer: Abhinandan Prateek <ab...@shapeblue.com>
Committed: Fri Jun 19 09:30:33 2015 +0530
----------------------------------------------------------------------
.../src/com/cloud/capacity/CapacityManagerImpl.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bcfb8240/server/src/com/cloud/capacity/CapacityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/capacity/CapacityManagerImpl.java b/server/src/com/cloud/capacity/CapacityManagerImpl.java
index f8a0e70..541c847 100644
--- a/server/src/com/cloud/capacity/CapacityManagerImpl.java
+++ b/server/src/com/cloud/capacity/CapacityManagerImpl.java
@@ -642,8 +642,18 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
ramOvercommitRatio = Float.parseFloat(vmDetailRam.getValue());
}
ServiceOffering so = offeringsMap.get(vm.getServiceOfferingId());
- reservedMemory += ((so.getRamSize() * 1024L * 1024L) / ramOvercommitRatio) * clusterRamOvercommitRatio;
- reservedCpu += (so.getCpu() * so.getSpeed() / cpuOvercommitRatio) * clusterCpuOvercommitRatio;
+ Map<String, String> vmDetails = _userVmDetailsDao.listDetailsKeyPairs(vm.getId());
+ if (so.isDynamic()) {
+ reservedMemory +=
+ ((Integer.parseInt(vmDetails.get(UsageEventVO.DynamicParameters.memory.name())) * 1024L * 1024L) / ramOvercommitRatio) *
+ clusterRamOvercommitRatio;
+ reservedCpu +=
+ ((Integer.parseInt(vmDetails.get(UsageEventVO.DynamicParameters.cpuNumber.name())) * Integer.parseInt(vmDetails.get(UsageEventVO.DynamicParameters.cpuSpeed.name()))) / cpuOvercommitRatio) *
+ clusterCpuOvercommitRatio;
+ } else {
+ reservedMemory += ((so.getRamSize() * 1024L * 1024L) / ramOvercommitRatio) * clusterRamOvercommitRatio;
+ reservedCpu += (so.getCpu() * so.getSpeed() / cpuOvercommitRatio) * clusterCpuOvercommitRatio;
+ }
} else {
// signal if not done already, that the VM has been stopped for skip.counting.hours,
// hence capacity will not be reserved anymore.