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)
This commit is contained in:
Anshul Gangwar 2014-10-20 16:04:25 +05:30 committed by Rajesh Battala
parent c04cdae60b
commit ae199b6ce7

View File

@ -120,6 +120,7 @@ import com.cloud.utils.db.TransactionCallback;
import com.cloud.utils.db.TransactionStatus; import com.cloud.utils.db.TransactionStatus;
import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.fsm.StateListener; import com.cloud.utils.fsm.StateListener;
import com.cloud.utils.fsm.StateMachine2;
import com.cloud.vm.DiskProfile; import com.cloud.vm.DiskProfile;
import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine;
@ -982,7 +983,10 @@ StateListener<State, VirtualMachine.Event, VirtualMachine> {
// if all hosts or all pools in the cluster are in avoid set after this // if all hosts or all pools in the cluster are in avoid set after this
// pass, then put the cluster in avoid set. // 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<HostVO> allhostsInCluster = List<HostVO> allhostsInCluster =
_hostDao.listAllUpAndEnabledNonHAHosts(Host.Type.Routing, clusterVO.getId(), clusterVO.getPodId(), clusterVO.getDataCenterId(), null); _hostDao.listAllUpAndEnabledNonHAHosts(Host.Type.Routing, clusterVO.getId(), clusterVO.getPodId(), clusterVO.getDataCenterId(), null);
@ -1016,7 +1020,7 @@ StateListener<State, VirtualMachine.Event, VirtualMachine> {
for (StoragePoolVO pool : allPoolsInCluster) { for (StoragePoolVO pool : allPoolsInCluster) {
if (!allocatorAvoidOutput.shouldAvoid(pool)) { if (!allocatorAvoidOutput.shouldAvoid(pool)) {
// there's some pool in the cluster that is not yet in avoid set // there's some pool in the cluster that is not yet in avoid set
avoidAllPools = false; avoidAllSharedPools = false;
break; break;
} }
} }
@ -1030,11 +1034,19 @@ StateListener<State, VirtualMachine.Event, VirtualMachine> {
if (!allocatorAvoidOutput.shouldAvoid(pool)) { if (!allocatorAvoidOutput.shouldAvoid(pool)) {
// there's some pool in the cluster that is not yet // there's some pool in the cluster that is not yet
// in avoid set // in avoid set
avoidAllPools = false; avoidAllLocalPools = false;
break; break;
} }
} }
} }
if (vmRequiresSharedStorage && vmRequiresLocalStorege) {
avoidAllPools = (avoidAllLocalPools || avoidAllSharedPools) ? true : false;
} else if (vmRequiresSharedStorage) {
avoidAllPools = avoidAllSharedPools;
} else if (vmRequiresLocalStorege) {
avoidAllPools = avoidAllLocalPools;
}
} }
if (avoidAllHosts || avoidAllPools) { if (avoidAllHosts || avoidAllPools) {