allow multiple clusters for baremetal planner

This commit is contained in:
frank 2011-10-27 17:31:25 -07:00
parent 6534620208
commit b4fffc9b30
1 changed files with 11 additions and 13 deletions

24
server/src/com/cloud/deploy/BareMetalPlanner.java Normal file → Executable file
View File

@ -87,22 +87,20 @@ public class BareMetalPlanner implements DeploymentPlanner {
}
}
List<ClusterVO> clusters = _clusterDao.listByDcHyType(vm.getDataCenterIdToDeployIn(), HypervisorType.BareMetal.toString());
if (clusters.size() != 1) {
throw new CloudRuntimeException("Invaild baremetal cluster number " + clusters.size());
}
Cluster cluster = clusters.get(0);
List<ClusterVO> clusters = _clusterDao.listByDcHyType(vm.getDataCenterIdToDeployIn(), HypervisorType.BareMetal.toString());
int cpu_requested;
long ram_requested;
HostVO target = null;
List<HostVO> hosts = _hostDao.listByCluster(cluster.getId());
if (hostTag != null) {
for (HostVO h : hosts) {
_hostDao.loadDetails(h);
if (h.getDetail("hostTag") != null && h.getDetail("hostTag").equalsIgnoreCase(hostTag)) {
target = h;
break;
for (ClusterVO cluster : clusters) {
List<HostVO> hosts = _hostDao.listByCluster(cluster.getId());
if (hostTag != null) {
for (HostVO h : hosts) {
_hostDao.loadDetails(h);
if (h.getDetail("hostTag") != null
&& h.getDetail("hostTag").equalsIgnoreCase(hostTag)) {
target = h;
break;
}
}
}
}