From 14e048dadabba67d09f85d12019fcd39b8b47db1 Mon Sep 17 00:00:00 2001 From: Anshul Gangwar Date: Wed, 19 Nov 2014 09:38:18 +0530 Subject: [PATCH] CLOUDSTACK-7752: Fixed deployment planner stuck in infinite loop. If we create VM with shared service offering and attach disk with local disk offering, and one of storage pool is full(cannot be allocated) and other is not full then we are not putting the cluster in avoid list which is causing this infinite loop. Fixed by putting the cluster in avoid list even if one of the storage pool is full(cannot be allocated) Signed-off-by: Daan Hoogland --- .../deploy/DeploymentPlanningManagerImpl.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java index d9e1ecc2291..04824e41d7d 100644 --- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java +++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java @@ -950,7 +950,10 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy // if all hosts or all pools in the cluster are in avoid set after this // pass, then put the cluster in avoid set. - boolean avoidAllHosts = true, avoidAllPools = true; + boolean avoidAllHosts = true; + boolean avoidAllPools = true; + boolean avoidAllLocalPools = true; + boolean avoidAllSharedPools = true; List allhostsInCluster = _hostDao.listAllUpAndEnabledNonHAHosts(Host.Type.Routing, clusterVO.getId(), clusterVO.getPodId(), clusterVO.getDataCenterId(), null); @@ -985,7 +988,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy for (StoragePoolVO pool : allPoolsInCluster) { if (!allocatorAvoidOutput.shouldAvoid(pool)) { // there's some pool in the cluster that is not yet in avoid set - avoidAllPools = false; + avoidAllSharedPools = false; break; } } @@ -999,11 +1002,19 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy if (!allocatorAvoidOutput.shouldAvoid(pool)) { // there's some pool in the cluster that is not yet // in avoid set - avoidAllPools = false; + avoidAllLocalPools = false; break; } } } + + if (vmRequiresSharedStorage && vmRequiresLocalStorege) { + avoidAllPools = (avoidAllLocalPools || avoidAllSharedPools) ? true : false; + } else if (vmRequiresSharedStorage) { + avoidAllPools = avoidAllSharedPools; + } else if (vmRequiresLocalStorege) { + avoidAllPools = avoidAllLocalPools; + } } if (avoidAllHosts || avoidAllPools) {