Skip to content

Commit 4705933

Browse files
committed
CLOUDSTACK-7703, 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)
1 parent c78f14c commit 4705933

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import javax.inject.Inject;
3232
import javax.naming.ConfigurationException;
3333

34-
import com.cloud.utils.fsm.StateMachine2;
3534
import org.apache.log4j.Logger;
3635

3736
import org.apache.cloudstack.affinity.AffinityGroupProcessor;
@@ -121,6 +120,7 @@
121120
import com.cloud.utils.db.TransactionStatus;
122121
import com.cloud.utils.exception.CloudRuntimeException;
123122
import com.cloud.utils.fsm.StateListener;
123+
import com.cloud.utils.fsm.StateMachine2;
124124
import com.cloud.vm.DiskProfile;
125125
import com.cloud.vm.VMInstanceVO;
126126
import com.cloud.vm.VirtualMachine;
@@ -990,7 +990,10 @@ private boolean canAvoidCluster(Cluster clusterVO, ExcludeList avoids, ExcludeLi
990990

991991
// if all hosts or all pools in the cluster are in avoid set after this
992992
// pass, then put the cluster in avoid set.
993-
boolean avoidAllHosts = true, avoidAllPools = true;
993+
boolean avoidAllHosts = true;
994+
boolean avoidAllPools = true;
995+
boolean avoidAllLocalPools = true;
996+
boolean avoidAllSharedPools = true;
994997

995998
List<HostVO> allhostsInCluster =
996999
_hostDao.listAllUpAndEnabledNonHAHosts(Host.Type.Routing, clusterVO.getId(), clusterVO.getPodId(), clusterVO.getDataCenterId(), null);
@@ -1024,7 +1027,7 @@ private boolean canAvoidCluster(Cluster clusterVO, ExcludeList avoids, ExcludeLi
10241027
for (StoragePoolVO pool : allPoolsInCluster) {
10251028
if (!allocatorAvoidOutput.shouldAvoid(pool)) {
10261029
// there's some pool in the cluster that is not yet in avoid set
1027-
avoidAllPools = false;
1030+
avoidAllSharedPools = false;
10281031
break;
10291032
}
10301033
}
@@ -1038,11 +1041,19 @@ private boolean canAvoidCluster(Cluster clusterVO, ExcludeList avoids, ExcludeLi
10381041
if (!allocatorAvoidOutput.shouldAvoid(pool)) {
10391042
// there's some pool in the cluster that is not yet
10401043
// in avoid set
1041-
avoidAllPools = false;
1044+
avoidAllLocalPools = false;
10421045
break;
10431046
}
10441047
}
10451048
}
1049+
1050+
if (vmRequiresSharedStorage && vmRequiresLocalStorege) {
1051+
avoidAllPools = (avoidAllLocalPools || avoidAllSharedPools) ? true : false;
1052+
} else if (vmRequiresSharedStorage) {
1053+
avoidAllPools = avoidAllSharedPools;
1054+
} else if (vmRequiresLocalStorege) {
1055+
avoidAllPools = avoidAllLocalPools;
1056+
}
10461057
}
10471058

10481059
if (avoidAllHosts || avoidAllPools) {

0 commit comments

Comments
 (0)