File tree Expand file tree Collapse file tree
server/src/com/cloud/deploy Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments