allow multiple clusters for baremetal planner

fix build
This commit is contained in:
frank 2011-10-27 17:42:25 -07:00
parent b4fffc9b30
commit cc6bf73760
1 changed files with 13 additions and 7 deletions

View File

@ -114,13 +114,19 @@ public class BareMetalPlanner implements DeploymentPlanner {
ram_requested = target.getTotalMemory();
}
for (HostVO h : hosts) {
if (h.getStatus() == Status.Up) {
if(_capacityMgr.checkIfHostHasCapacity(h.getId(), cpu_requested, ram_requested, false, cpuOverprovisioningFactor)){
s_logger.debug("Find host " + h.getId() + " has enough capacity");
DataCenter dc = _dcDao.findById(h.getDataCenterId());
Pod pod = _podDao.findById(h.getPodId());
return new DeployDestination(dc, pod, cluster, h);
for (ClusterVO cluster : clusters) {
List<HostVO> hosts = _hostDao.listByCluster(cluster.getId());
for (HostVO h : hosts) {
if (h.getStatus() == Status.Up) {
if (_capacityMgr.checkIfHostHasCapacity(h.getId(),
cpu_requested, ram_requested, false,
cpuOverprovisioningFactor)) {
s_logger.debug("Find host " + h.getId()
+ " has enough capacity");
DataCenter dc = _dcDao.findById(h.getDataCenterId());
Pod pod = _podDao.findById(h.getPodId());
return new DeployDestination(dc, pod, cluster, h);
}
}
}
}