Skip to content

Commit c81477a

Browse files
author
frank
committed
allow multiple clusters for baremetal planner
Conflicts: server/src/com/cloud/deploy/BareMetalPlanner.java
1 parent 171e11a commit c81477a

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

‎server/src/com/cloud/deploy/BareMetalPlanner.java‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,21 @@ public DeployDestination plan(VirtualMachineProfile<? extends VirtualMachine> vm
8787
}
8888
}
8989

90-
List<ClusterVO> clusters = _clusterDao.listByDcHyType(vm.getDataCenterIdToDeployIn(), HypervisorType.BareMetal.toString());
91-
if (clusters.size() != 1) {
92-
throw new CloudRuntimeException("Invaild baremetal cluster number " + clusters.size());
93-
}
94-
Cluster cluster = clusters.get(0);
95-
90+
List<ClusterVO> clusters = _clusterDao.listByDcHyType(vm.getDataCenterIdToDeployIn(), HypervisorType.BareMetal.toString());
9691
int cpu_requested;
9792
long ram_requested;
9893
HostVO target = null;
99-
List<HostVO> hosts = _resourceMgr.listAllHostsInCluster(cluster.getId());
100-
if (hostTag != null) {
101-
for (HostVO h : hosts) {
102-
_hostDao.loadDetails(h);
103-
if (h.getDetail("hostTag") != null && h.getDetail("hostTag").equalsIgnoreCase(hostTag)) {
104-
target = h;
105-
break;
94+
List<HostVO> hosts;
95+
for (ClusterVO cluster : clusters) {
96+
hosts = _resourceMgr.listAllHostsInCluster(cluster.getId());
97+
if (hostTag != null) {
98+
for (HostVO h : hosts) {
99+
_hostDao.loadDetails(h);
100+
if (h.getDetail("hostTag") != null
101+
&& h.getDetail("hostTag").equalsIgnoreCase(hostTag)) {
102+
target = h;
103+
break;
104+
}
106105
}
107106
}
108107
}

0 commit comments

Comments
 (0)