Manually Merged from master the remaining changes for Bug 9539 - cpu.overprovisioning.factor does not work

This commit is contained in:
prachi 2011-04-22 18:58:00 -07:00
parent 5706041ef7
commit 074e143986
2 changed files with 9 additions and 3 deletions

View File

@ -3031,7 +3031,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory,
if (capacityVOCpus != null && !capacityVOCpus.isEmpty()) {
CapacityVO CapacityVOCpu = capacityVOCpus.get(0);
long newTotalCpu = (long) (server.getCpus().longValue()
* server.getSpeed().longValue() * _cpuOverProvisioningFactor);
* server.getSpeed().longValue());
if ((CapacityVOCpu.getTotalCapacity() <= newTotalCpu)
|| ((CapacityVOCpu.getUsedCapacity() + CapacityVOCpu
.getReservedCapacity()) <= newTotalCpu)) {
@ -3056,7 +3056,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory,
server.getClusterId(),
0L,
(long) (server.getCpus().longValue()
* server.getSpeed().longValue() * _cpuOverProvisioningFactor),
* server.getSpeed().longValue()),
CapacityVO.CAPACITY_TYPE_CPU);
_capacityDao.persist(capacity);
}

View File

@ -1302,7 +1302,13 @@ public class ManagementServerImpl implements ManagementServer {
s_logger.debug("Searching for hosts in cluster: " +cluster+ " having required CPU: " +requiredCpu+ " and RAM:"+ requiredRam);
}
List<Long> hostsWithCapacity = _capacityDao.listHostsWithEnoughCapacity(requiredCpu, requiredRam, cluster, hostType.name());
String opFactor = _configDao.getValue(Config.CPUOverprovisioningFactor.key());
float cpuOverprovisioningFactor = NumbersUtil.parseFloat(opFactor, 1);
if (s_logger.isDebugEnabled()) {
s_logger.debug("CPUOverprovisioningFactor considered: " + cpuOverprovisioningFactor);
}
List<Long> hostsWithCapacity = _capacityDao.listHostsWithEnoughCapacity(requiredCpu, requiredRam, cluster, hostType.name(), cpuOverprovisioningFactor);
if(s_logger.isDebugEnabled()){
s_logger.debug("Hosts having capacity: "+hostsWithCapacity );