@Override public PrimaryDataStore getPrimaryDataStore(String uuid) { StoragePoolVO dataStoreVO = dataStoreDao.findByUuid(uuid); return getPrimaryDataStore(dataStoreVO.getId()); }
public long getStoragePoolIdForStoragePoolUuid(String storagePoolUuid) { StoragePoolVO storagePool = storagePoolDao.findByUuid(storagePoolUuid); if (storagePool == null) { throw new CloudRuntimeException("Unable to find Volume for ID: " + storagePoolUuid); } return storagePool.getId(); }
/** * We will add a mapping of volume to storage pool if needed. The conditions to add a mapping are the following: * <ul> * <li> The candidate storage pool where the volume is to be allocated can be accessed by the target host * <li> If no storage pool is found to allocate the volume we throw an exception. * </ul> * * Side note: this method should only be called if the volume is on local storage or if we are executing a cross cluster migration. */ protected void createVolumeToStoragePoolMappingIfPossible(VirtualMachineProfile profile, Host targetHost, Map<Volume, StoragePool> volumeToPoolObjectMap, Volume volume, StoragePoolVO currentPool) { List<StoragePool> storagePoolList = getCandidateStoragePoolsToMigrateLocalVolume(profile, targetHost, volume); if (CollectionUtils.isEmpty(storagePoolList)) { throw new CloudRuntimeException(String.format("There is not storage pools available at the target host [%s] to migrate volume [%s]", targetHost.getUuid(), volume.getUuid())); } Collections.shuffle(storagePoolList); boolean canTargetHostAccessVolumeCurrentStoragePool = false; for (StoragePool storagePool : storagePoolList) { if (storagePool.getId() == currentPool.getId()) { canTargetHostAccessVolumeCurrentStoragePool = true; break; } } if (!canTargetHostAccessVolumeCurrentStoragePool) { volumeToPoolObjectMap.put(volume, _storagePoolDao.findByUuid(storagePoolList.get(0).getUuid())); } }
StoragePoolVO pool = _storagePoolDao.findByUuid(entry.getValue()); if (volume == null) { throw new InvalidParameterValueException("There is no volume present with the given id " + entry.getKey());