/** * The following method performs a removing of all cinder disks from vm. These is only DB * operation */ private void removeCinderDisks(List<CinderDisk> cinderDisks) { RemoveAllVmCinderDisksParameters removeParam = new RemoveAllVmCinderDisksParameters(getVmTemplateId(), cinderDisks); removeParam.setParentHasTasks(!getReturnValue().getVdsmTaskIdList().isEmpty()); Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveAllVmCinderDisks, withRootCommandInfo(removeParam), cloneContextAndDetachFromParent(), CINDERStorageHelper.getStorageEntities(cinderDisks)); try { future.get().getActionReturnValue(); } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); } }
/** * The following method will perform a removing of all cinder disks from vm. These is only DB * operation */ private Collection<CinderDisk> removeCinderDisks() { Collection<CinderDisk> failedRemoveCinderDisks = null; if (getParameters().isRemoveDisks()) { List<CinderDisk> cinderDisks = getCinderDisks(); if (cinderDisks.isEmpty()) { return Collections.emptyList(); } RemoveAllVmCinderDisksParameters param = new RemoveAllVmCinderDisksParameters(getVmId(), cinderDisks); param.setEndProcedure(EndProcedure.COMMAND_MANAGED); Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveAllVmCinderDisks, withRootCommandInfo(param), cloneContextAndDetachFromParent()); try { failedRemoveCinderDisks = future.get().getActionReturnValue(); } catch (InterruptedException | ExecutionException e) { failedRemoveCinderDisks = cinderDisks; log.error("Exception", e); } } return failedRemoveCinderDisks; }