CLOUDSTACK-5426: Cannot deploy instance having multiple volumes that use different storage tags for storage pools in same cluster

Changes:
- We need to reset the avoid set to its original state while calling the storage pool allocators for each volume.
- This will prevent affecting allocation of the disks due to the avoid set output of the prior disk allocations.

Conflicts:

	server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
This commit is contained in:
Prachi Damle 2013-12-09 14:53:48 -08:00
parent 1db19c3d52
commit 5618a44ed0
1 changed files with 19 additions and 1 deletions

View File

@ -1119,6 +1119,12 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
// for each volume find list of suitable storage pools by calling the
// allocators
Set<Long> originalAvoidPoolSet = avoid.getPoolsToAvoid();
if (originalAvoidPoolSet == null) {
originalAvoidPoolSet = new HashSet<Long>();
}
Set<Long> poolsToAvoidOutput = new HashSet<Long>(originalAvoidPoolSet);
for (VolumeVO toBeCreated : volumesTobeCreated) {
s_logger.debug("Checking suitable pools for volume (Id, Type): (" + toBeCreated.getId() + "," + toBeCreated.getVolumeType().name() + ")");
@ -1228,6 +1234,11 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
}
}
if (avoid.getPoolsToAvoid() != null) {
poolsToAvoidOutput.addAll(avoid.getPoolsToAvoid());
avoid.getPoolsToAvoid().retainAll(originalAvoidPoolSet);
}
if (!foundPotentialPools) {
s_logger.debug("No suitable pools found for volume: " + toBeCreated + " under cluster: " + plan.getClusterId());
// No suitable storage pools found under this cluster for this
@ -1239,6 +1250,13 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
}
}
if (suitableVolumeStoragePools.values() != null) {
poolsToAvoidOutput.removeAll(suitableVolumeStoragePools.values());
}
if (avoid.getPoolsToAvoid() != null) {
avoid.getPoolsToAvoid().addAll(poolsToAvoidOutput);
}
if (suitableVolumeStoragePools.isEmpty()) {
s_logger.debug("No suitable pools found");
}
@ -1346,4 +1364,4 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
}
return true;
}
}
}