mirror of https://github.com/apache/cloudstack.git
CS-16117 : Load Test - In a 5000 hosts/5000 vm setup ,~450 Vms failed to get deployed becasue of "com.cloud.exception.InsufficientServerCapacityException" even though we have hosts that have enough capacity to host the vms.
Using associated VM host id only in case of data disk. Also moved the allocation logic for local disk from FirstFit to LocalStoragePoolAllocator. Reviewed-by: Nitin
This commit is contained in:
parent
c46890bc7b
commit
83651f535e
|
|
@ -26,6 +26,7 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import com.cloud.deploy.DeploymentPlan;
|
||||
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.server.StatsCollector;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StoragePoolHostVO;
|
||||
|
|
@ -73,23 +74,11 @@ public class FirstFitStoragePoolAllocator extends AbstractStoragePoolAllocator {
|
|||
s_logger.debug("Looking for pools in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId);
|
||||
}
|
||||
|
||||
List<StoragePoolVO> pools = null;
|
||||
// volume is shared "or" vm is not known "or" no host associated then go here
|
||||
if (!dskCh.useLocalStorage() || vmProfile.getVirtualMachine() == null || vmProfile.getVirtualMachine().getHostId() == null) {
|
||||
pools = _storagePoolDao.findPoolsByTags(dcId, podId, clusterId, dskCh.getTags(), !dskCh.useLocalStorage());
|
||||
} else { // volume is local and vm host id is known
|
||||
pools = new ArrayList<StoragePoolVO>();
|
||||
List<StoragePoolHostVO> hostPools = _poolHostDao.listByHostId(vmProfile.getVirtualMachine().getHostId());
|
||||
for (StoragePoolHostVO hostPool: hostPools) {
|
||||
StoragePoolVO pool = _storagePoolDao.findById(hostPool.getPoolId());
|
||||
if (pool != null && pool.isLocal()) {
|
||||
pools.add(pool);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<StoragePoolVO> pools = _storagePoolDao.findPoolsByTags(dcId, podId, clusterId, dskCh.getTags(), null);
|
||||
if (pools.size() == 0) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("No storage pools available for " + (dskCh.useLocalStorage() ? "local" : "shared") + " volume allocation, returning");
|
||||
String storageType = dskCh.useLocalStorage() ? ServiceOffering.StorageType.local.toString() : ServiceOffering.StorageType.shared.toString();
|
||||
s_logger.debug("No storage pools available for " + storageType + " volume allocation, returning");
|
||||
}
|
||||
return suitablePools;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ import com.cloud.offering.ServiceOffering;
|
|||
import com.cloud.service.dao.ServiceOfferingDao;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StoragePoolHostVO;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.StoragePoolHostDao;
|
||||
import com.cloud.utils.DateUtil;
|
||||
|
|
@ -97,18 +99,34 @@ public class LocalStoragePoolAllocator extends FirstFitStoragePoolAllocator {
|
|||
s_logger.debug("LocalStoragePoolAllocator trying to find storage pool to fit the vm");
|
||||
}
|
||||
|
||||
List<StoragePool> availablePool;
|
||||
while (!(availablePool = super.allocateToPool(dskCh, vmProfile, plan, myAvoids, 1)).isEmpty()) {
|
||||
StoragePool pool = availablePool.get(0);
|
||||
myAvoids.addPool(pool.getId());
|
||||
List<StoragePoolHostVO> hostsInSPool = _poolHostDao.listByPoolId(pool.getId());
|
||||
assert (hostsInSPool.size() == 1) : "Local storage pool should be one host per pool";
|
||||
// data disk and host identified from deploying vm (attach volume case)
|
||||
if (dskCh.getType() == Volume.Type.DATADISK && vmProfile.getVirtualMachine() != null && vmProfile.getVirtualMachine().getHostId() != null) {
|
||||
List<StoragePoolHostVO> hostPools = _poolHostDao.listByHostId(vmProfile.getVirtualMachine().getHostId());
|
||||
for (StoragePoolHostVO hostPool: hostPools) {
|
||||
StoragePoolVO pool = _storagePoolDao.findById(hostPool.getPoolId());
|
||||
if (pool != null && pool.isLocal()) {
|
||||
s_logger.debug("Found suitable local storage pool " + pool.getId() + ", adding to list");
|
||||
suitablePools.add(pool);
|
||||
}
|
||||
|
||||
s_logger.debug("Found suitable local storage pool " + pool.getId() + ", adding to list");
|
||||
suitablePools.add(pool);
|
||||
if (suitablePools.size() == returnUpTo) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<StoragePool> availablePool;
|
||||
while (!(availablePool = super.allocateToPool(dskCh, vmProfile, plan, myAvoids, 1)).isEmpty()) {
|
||||
StoragePool pool = availablePool.get(0);
|
||||
myAvoids.addPool(pool.getId());
|
||||
List<StoragePoolHostVO> hostsInSPool = _poolHostDao.listByPoolId(pool.getId());
|
||||
assert (hostsInSPool.size() == 1) : "Local storage pool should be one host per pool";
|
||||
|
||||
if (suitablePools.size() == returnUpTo) {
|
||||
break;
|
||||
s_logger.debug("Found suitable local storage pool " + pool.getId() + ", adding to list");
|
||||
suitablePools.add(pool);
|
||||
|
||||
if (suitablePools.size() == returnUpTo) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue