From 5618a44ed0089e43ec24847b0b7db5c7e754fdb7 Mon Sep 17 00:00:00 2001 From: Prachi Damle Date: Mon, 9 Dec 2013 14:53:48 -0800 Subject: [PATCH] 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 --- .../deploy/DeploymentPlanningManagerImpl.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java index 8b7ed877877..a0890c288db 100644 --- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java +++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java @@ -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 originalAvoidPoolSet = avoid.getPoolsToAvoid(); + if (originalAvoidPoolSet == null) { + originalAvoidPoolSet = new HashSet(); + } + Set poolsToAvoidOutput = new HashSet(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; } -} +} \ No newline at end of file