@DB protected Volume liveMigrateVolume(Volume volume, StoragePool destPool) { VolumeInfo vol = volFactory.getVolume(volume.getId()); AsyncCallFuture<VolumeApiResult> future = volService.migrateVolume(vol, (DataStore)destPool); try { VolumeApiResult result = future.get(); if (result.isFailed()) { s_logger.debug("migrate volume failed:" + result.getResult()); return null; } return result.getVolume(); } catch (InterruptedException e) { s_logger.debug("migrate volume failed", e); return null; } catch (ExecutionException e) { s_logger.debug("migrate volume failed", e); return null; } }
@DB protected Volume liveMigrateVolume(Volume volume, StoragePool destPool) throws StorageUnavailableException { VolumeInfo vol = volFactory.getVolume(volume.getId()); DataStore dataStoreTarget = dataStoreMgr.getDataStore(destPool.getId(), DataStoreRole.Primary); AsyncCallFuture<VolumeApiResult> future = volService.migrateVolume(vol, dataStoreTarget); try { VolumeApiResult result = future.get(); if (result.isFailed()) { s_logger.debug("migrate volume failed:" + result.getResult()); throw new StorageUnavailableException("Migrate volume failed: " + result.getResult(), destPool.getId()); } return result.getVolume(); } catch (InterruptedException e) { s_logger.debug("migrate volume failed", e); throw new CloudRuntimeException(e.getMessage()); } catch (ExecutionException e) { s_logger.debug("migrate volume failed", e); throw new CloudRuntimeException(e.getMessage()); } }
if (result.isFailed()) { LOGGER.warn("Failed to create a volume: " + result.getResult());
try { VolumeApiResult result = future.get(); if (result.isFailed()) { s_logger.debug("Failed to create volume from snapshot:" + result.getResult()); throw new CloudRuntimeException("Failed to create volume from snapshot:" + result.getResult());
if (result.isFailed()) { LOGGER.warn("Failed to create a volume: " + result.getResult());
VolumeApiResult result = future.get(); if (result.isFailed()) { s_logger.warn("Failed to resize the volume " + volume); String details = "";
try { result = future.get(); if (result.isFailed()) { if (result.getResult().contains("request template reload") && (i == 0)) { s_logger.debug("Retry template re-deploy for vmware");
if (result.isFailed()) { throw new CloudRuntimeException("Failed to copy template " + templateOnPrimary.getId() + " to primary storage " + destPrimaryDataStore.getId() + ": " + result.getResult());
if (result.isFailed()) { if (result.getResult().contains("request template reload") && (i == 0)) { s_logger.debug("Retry template re-deploy for vmware");
VolumeApiResult result = future.get(); if (result.isFailed()) { LOGGER.error("Failed to create a volume: " + result.getResult());
if (result.isFailed()) { String errMesg = result.getResult();
AsyncCallFuture<VolumeApiResult> destroyFuture = expungeVolumeAsync(srcVolume); if (destroyFuture.get().isFailed()) { Thread.sleep(5 * 1000); destroyFuture = expungeVolumeAsync(srcVolume);
throw new CloudRuntimeException("Failed to copy volume", e1); if (cvResult == null || cvResult.isFailed()) { String errorString = "Failed to copy the volume from the source primary storage pool to secondary storage."; throw new CloudRuntimeException(errorString);
try { VolumeApiResult result = future.get(); if (result.isFailed()) { s_logger.error("Migrate volume failed:" + result.getResult()); throw new StorageUnavailableException("Migrate volume failed: " + result.getResult(), destPool.getId());
@DB public VolumeInfo copyVolumeFromSecToPrimary(VolumeInfo volume, VirtualMachine vm, VirtualMachineTemplate template, DataCenter dc, Pod pod, Long clusterId, ServiceOffering offering, DiskOffering diskOffering, List<StoragePool> avoids, long size, HypervisorType hyperType) throws NoTransitionException { final HashSet<StoragePool> avoidPools = new HashSet<StoragePool>(avoids); DiskProfile dskCh = createDiskCharacteristics(volume, template, dc, diskOffering); dskCh.setHyperType(vm.getHypervisorType()); storageMgr.setDiskProfileThrottling(dskCh, null, diskOffering); // Find a suitable storage to create volume on StoragePool destPool = findStoragePool(dskCh, dc, pod, clusterId, null, vm, avoidPools); if (destPool == null) { throw new CloudRuntimeException("Failed to find a suitable storage pool to create Volume in the pod/cluster of the provided VM "+ vm.getUuid()); } DataStore destStore = dataStoreMgr.getDataStore(destPool.getId(), DataStoreRole.Primary); AsyncCallFuture<VolumeApiResult> future = volService.copyVolume(volume, destStore); try { VolumeApiResult result = future.get(); if (result.isFailed()) { s_logger.debug("copy volume failed: " + result.getResult()); throw new CloudRuntimeException("copy volume failed: " + result.getResult()); } return result.getVolume(); } catch (InterruptedException e) { s_logger.debug("Failed to copy volume: " + volume.getId(), e); throw new CloudRuntimeException("Failed to copy volume", e); } catch (ExecutionException e) { s_logger.debug("Failed to copy volume: " + volume.getId(), e); throw new CloudRuntimeException("Failed to copy volume", e); } }