@Override public void execute() throws Exception { NamedVolumesList volumesToUse = BlockStorageUtils.getVolumesBySite(getClient(), virtualArrayParameter, applicationId); List<URI> volumeIds = BlockStorageUtils.getSingleVolumePerSubGroupAndStorageSystem(volumesToUse, subGroups); checkAndPurgeObsoleteSnapshots(applicationId); Tasks<? extends DataObjectRestRep> tasks = execute(new CreateSnapshotForApplication(applicationId, volumeIds, name, readOnly)); addAffectedResources(tasks); addRetainedReplicas(applicationId, tasks.getTasks()); }
private Tasks<UnManagedVolumeRestRep> executeChunks(VolumeIngest ingest) { Tasks<UnManagedVolumeRestRep> results = null; int i = 0; for (Iterator<URI> ids = unmanagedVolumeIds.iterator(); ids.hasNext(); ) { i++; URI id = ids.next(); ingest.getUnManagedVolumes().add(id); if (i == INGEST_CHUNK_SIZE || !ids.hasNext()) { Tasks<UnManagedVolumeRestRep> currentChunk = ingestVolumes(ingest); if (results == null) { results = currentChunk; } else { results.getTasks().addAll(currentChunk.getTasks()); } ingest.getUnManagedVolumes().clear(); i = 0; } } return results; }
@Override public Tasks<VolumeRestRep> doExecute() throws Exception { VolumeCreate create = new VolumeCreate(); create.setVpool(vpoolId); create.setVarray(varrayId); create.setProject(projectId); create.setName(copyName); create.setSize(size); int numberOfVolumes = 1; if ((count != null) && (count > 1)) { numberOfVolumes = count; } create.setCount(numberOfVolumes); create.setConsistencyGroup(consistencyGroupId); Tasks<VolumeRestRep> tasks = getClient().blockVolumes().addJournalCapacity(create); // There should only be as many tasks as is the count if (tasks.getTasks().size() != numberOfVolumes) { throw stateException("CreateBlockVolume.illegalState.invalid", tasks.getTasks().size()); } return tasks; }