diff --git a/server/src/com/cloud/storage/allocator/LocalStoragePoolAllocator.java b/server/src/com/cloud/storage/allocator/LocalStoragePoolAllocator.java index 935dd7d529e..8eed13db75b 100644 --- a/server/src/com/cloud/storage/allocator/LocalStoragePoolAllocator.java +++ b/server/src/com/cloud/storage/allocator/LocalStoragePoolAllocator.java @@ -29,12 +29,15 @@ import javax.naming.ConfigurationException; import org.apache.log4j.Logger; +import com.cloud.agent.manager.allocator.HostAllocator; +import com.cloud.agent.manager.allocator.impl.FirstFitAllocator; import com.cloud.agent.api.to.DiskCharacteristicsTO; import com.cloud.capacity.CapacityVO; import com.cloud.capacity.dao.CapacityDao; import com.cloud.configuration.dao.ConfigurationDao; import com.cloud.dc.DataCenterVO; import com.cloud.dc.HostPodVO; +import com.cloud.host.Host; import com.cloud.service.ServiceOffering; import com.cloud.service.ServiceOfferingVO; import com.cloud.service.ServiceOffering.GuestIpType; @@ -57,6 +60,7 @@ import com.cloud.vm.VirtualMachine; import com.cloud.vm.VmCharacteristics; import com.cloud.vm.dao.UserVmDao; import com.cloud.vm.dao.VMInstanceDao; +import com.cloud.storage.StoragePoolVO; // // TODO @@ -73,7 +77,8 @@ public class LocalStoragePoolAllocator extends FirstFitStoragePoolAllocator { @Inject ServiceOfferingDao _offeringDao; @Inject CapacityDao _capacityDao; @Inject ConfigurationDao _configDao; - + + HostAllocator _allocator = null; protected SearchBuilder VmsOnPoolSearch; @@ -112,6 +117,10 @@ public class LocalStoragePoolAllocator extends FirstFitStoragePoolAllocator { return pool; } + if (_allocator.allocateTo(vmc, offering, Host.Type.Routing, dc, pod, (StoragePoolVO)pool, template, new HashSet()) == null) { + continue; + } + List hostsInSPool = _poolHostDao.listByPoolId(pool.getId()); assert(hostsInSPool.size() == 1) : "Local storage pool should be one host per pool"; @@ -298,6 +307,9 @@ public class LocalStoragePoolAllocator extends FirstFitStoragePoolAllocator { sbVolume.done(); VmsOnPoolSearch.done(); + _allocator = new FirstFitAllocator(); + _allocator.configure("First fit", params); + return true; }