From 486c75ea4b11fa28a67033c9a7735b83696bb6da Mon Sep 17 00:00:00 2001 From: prachi Date: Fri, 6 May 2011 18:04:54 -0700 Subject: [PATCH] Bug 9780 - ComputeCapacityListener should not use 'cpu.overprovisioning.factor' while adding capacity entries Changes: Reapplying the changes from fix 9539 that were missing in ComputeCapacityListener.java Change is to not consider cpu.overprovisioning.factor while creating CPU capacity entries. This factor is applied by allocators to the values in the capacity table. Capacity table should contain the actual CPU value and not the overprovisioned CPU value. --- .../com/cloud/capacity/ComputeCapacityListener.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/server/src/com/cloud/capacity/ComputeCapacityListener.java b/server/src/com/cloud/capacity/ComputeCapacityListener.java index 612a1aba0b9..82efe06889f 100644 --- a/server/src/com/cloud/capacity/ComputeCapacityListener.java +++ b/server/src/com/cloud/capacity/ComputeCapacityListener.java @@ -29,7 +29,6 @@ import com.cloud.agent.api.Answer; import com.cloud.agent.api.Command; import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupRoutingCommand; -import com.cloud.agent.api.StartupStorageCommand; import com.cloud.capacity.dao.CapacityDao; import com.cloud.exception.ConnectionException; import com.cloud.host.HostVO; @@ -66,7 +65,7 @@ public class ComputeCapacityListener implements Listener { @Override public AgentControlAnswer processControlCommand(long agentId, AgentControlCommand cmd) { - + return null; } @@ -93,8 +92,8 @@ public class ComputeCapacityListener implements Listener { if (capacityVOCpus != null && !capacityVOCpus.isEmpty()) { CapacityVO CapacityVOCpu = capacityVOCpus.get(0); - long newTotalCpu = (long) (server.getCpus().longValue() - * server.getSpeed().longValue() * _cpuOverProvisioningFactor); + long newTotalCpu = (server.getCpus().longValue() + * server.getSpeed().longValue()); if ((CapacityVOCpu.getTotalCapacity() <= newTotalCpu) || ((CapacityVOCpu.getUsedCapacity() + CapacityVOCpu .getReservedCapacity()) <= newTotalCpu)) { @@ -118,8 +117,8 @@ public class ComputeCapacityListener implements Listener { server.getPodId(), server.getClusterId(), 0L, - (long) (server.getCpus().longValue() - * server.getSpeed().longValue() * _cpuOverProvisioningFactor), + (server.getCpus().longValue() + * server.getSpeed().longValue()), CapacityVO.CAPACITY_TYPE_CPU); _capacityDao.persist(capacity); } @@ -180,7 +179,7 @@ public class ComputeCapacityListener implements Listener { return false; } - + @Override public int getTimeout() { return 0;