protected List<StoragePool> getCandidateStoragePoolsToMigrateLocalVolume(VirtualMachineProfile profile, Host targetHost, Volume volume) {
List<StoragePool> poolList = new ArrayList<>();
DiskOfferingVO diskOffering = _diskOfferingDao.findById(volume.getDiskOfferingId());
DiskProfile diskProfile = new DiskProfile(volume, diskOffering, profile.getHypervisorType());
DataCenterDeployment plan = new DataCenterDeployment(targetHost.getDataCenterId(), targetHost.getPodId(), targetHost.getClusterId(), targetHost.getId(), null, null);
ExcludeList avoid = new ExcludeList();
StoragePoolVO volumeStoragePool = _storagePoolDao.findById(volume.getPoolId());
if (volumeStoragePool.isLocal()) {
diskProfile.setUseLocalStorage(true);
}
for (StoragePoolAllocator allocator : _storagePoolAllocators) {
List<StoragePool> poolListFromAllocator = allocator.allocateToPool(diskProfile, profile, plan, avoid, StoragePoolAllocator.RETURN_UPTO_ALL);
if (CollectionUtils.isEmpty(poolListFromAllocator)) {
continue;
}
for (StoragePool pool : poolListFromAllocator) {
if (pool.isLocal() || isStorageCrossClusterMigration(targetHost, volumeStoragePool)) {
poolList.add(pool);
}
}
}
return poolList;
}