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.
This commit is contained in:
prachi 2011-05-06 18:04:54 -07:00
parent fe3f74a56a
commit 486c75ea4b

View File

@ -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;