Skip to content

Commit a69101d

Browse files
author
Prachi Damle
committed
- To check if a host is in avoid set, DPM should check the zones/pods/cluster/hosts in teh avoid list - not just the hosts in avoid list.
1 parent c52879b commit a69101d

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

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

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -380,27 +380,27 @@ public DeployDestination planDeployment(VirtualMachineProfile<? extends VirtualM
380380

381381
if (planner instanceof DeploymentClusterPlanner) {
382382

383-
ExcludeList PlannerAvoidInput = new ExcludeList(avoids.getDataCentersToAvoid(),
383+
ExcludeList plannerAvoidInput = new ExcludeList(avoids.getDataCentersToAvoid(),
384384
avoids.getPodsToAvoid(), avoids.getClustersToAvoid(), avoids.getHostsToAvoid(),
385385
avoids.getPoolsToAvoid());
386386

387387
clusterList = ((DeploymentClusterPlanner) planner).orderClusters(vmProfile, plan, avoids);
388388

389389
if (clusterList != null && !clusterList.isEmpty()) {
390390
// planner refactoring. call allocators to list hosts
391-
ExcludeList PlannerAvoidOutput = new ExcludeList(avoids.getDataCentersToAvoid(),
391+
ExcludeList plannerAvoidOutput = new ExcludeList(avoids.getDataCentersToAvoid(),
392392
avoids.getPodsToAvoid(), avoids.getClustersToAvoid(), avoids.getHostsToAvoid(),
393393
avoids.getPoolsToAvoid());
394394

395-
resetAvoidSet(PlannerAvoidOutput, PlannerAvoidInput);
395+
resetAvoidSet(plannerAvoidOutput, plannerAvoidInput);
396396

397397
dest = checkClustersforDestination(clusterList, vmProfile, plan, avoids, dc,
398-
getPlannerUsage(planner), PlannerAvoidOutput);
398+
getPlannerUsage(planner), plannerAvoidOutput);
399399
if (dest != null) {
400400
return dest;
401401
}
402402
// reset the avoid input to the planners
403-
resetAvoidSet(avoids, PlannerAvoidOutput);
403+
resetAvoidSet(avoids, plannerAvoidOutput);
404404

405405
} else {
406406
return null;
@@ -815,12 +815,8 @@ private boolean canAvoidCluster(Cluster clusterVO, ExcludeList avoids, ExcludeLi
815815

816816
// remove any hosts/pools that the planners might have added
817817
// to get the list of hosts/pools that Allocators flagged as 'avoid'
818-
if (allocatorAvoidOutput.getHostsToAvoid() != null && plannerAvoidOutput.getHostsToAvoid() != null) {
819-
allocatorAvoidOutput.getHostsToAvoid().removeAll(plannerAvoidOutput.getHostsToAvoid());
820-
}
821-
if (allocatorAvoidOutput.getPoolsToAvoid() != null && plannerAvoidOutput.getPoolsToAvoid() != null) {
822-
allocatorAvoidOutput.getPoolsToAvoid().removeAll(plannerAvoidOutput.getPoolsToAvoid());
823-
}
818+
819+
resetAvoidSet(allocatorAvoidOutput, plannerAvoidOutput);
824820

825821
// if all hosts or all pools in the cluster are in avoid set after this
826822
// pass, then put the cluster in avoid set.
@@ -829,8 +825,7 @@ private boolean canAvoidCluster(Cluster clusterVO, ExcludeList avoids, ExcludeLi
829825
List<HostVO> allhostsInCluster = _hostDao.listAllUpAndEnabledNonHAHosts(Host.Type.Routing, clusterVO.getId(),
830826
clusterVO.getPodId(), clusterVO.getDataCenterId(), null);
831827
for (HostVO host : allhostsInCluster) {
832-
if (allocatorAvoidOutput.getHostsToAvoid() == null
833-
|| !allocatorAvoidOutput.getHostsToAvoid().contains(host.getId())) {
828+
if (!allocatorAvoidOutput.shouldAvoid(host)) {
834829
// there's some host in the cluster that is not yet in avoid set
835830
avoidAllHosts = false;
836831
}
@@ -839,8 +834,7 @@ private boolean canAvoidCluster(Cluster clusterVO, ExcludeList avoids, ExcludeLi
839834
List<StoragePoolVO> allPoolsInCluster = _storagePoolDao.findPoolsByTags(clusterVO.getDataCenterId(),
840835
clusterVO.getPodId(), clusterVO.getId(), null);
841836
for (StoragePoolVO pool : allPoolsInCluster) {
842-
if (allocatorAvoidOutput.getPoolsToAvoid() == null
843-
|| !allocatorAvoidOutput.getPoolsToAvoid().contains(pool.getId())) {
837+
if (!allocatorAvoidOutput.shouldAvoid(pool)) {
844838
// there's some pool in the cluster that is not yet in avoid set
845839
avoidAllPools = false;
846840
}

0 commit comments

Comments
 (0)