Search in sources :

Example 26 with Tasks

use of com.emc.vipr.client.Tasks in project coprhd-controller by CoprHD.

the class BlockVolumes method deactivateContinuousCopies.

/**
 * Begins deactivating a number of continuous copies for the given block volume.
 * <p>
 * API Call: <tt>POST /block/volumes/{id}/protection/continuous-copies/deactivate</tt>
 *
 * @param id
 *            the ID of the block volume.
 * @param input
 *            the copy configurations.
 * @param type
 *            {@code FULL} or {@code VIPR_ONLY}
 *
 * @return tasks for monitoring the progress of the operation.
 */
public Tasks<VolumeRestRep> deactivateContinuousCopies(URI id, CopiesParam input, VolumeDeleteTypeEnum type) {
    URI uri = client.uriBuilder(getContinuousCopiesUrl() + "/deactivate").queryParam("type", type).build(id);
    TaskList tasks = client.postURI(TaskList.class, input, uri);
    return new Tasks<>(client, tasks.getTaskList(), resourceClass);
}
Also used : Tasks(com.emc.vipr.client.Tasks) TaskList(com.emc.storageos.model.TaskList) URI(java.net.URI)

Example 27 with Tasks

use of com.emc.vipr.client.Tasks in project coprhd-controller by CoprHD.

the class AddHostsToMobilityGroup method doExecute.

@Override
protected Tasks<TaskResourceRep> doExecute() throws Exception {
    VolumeGroupUpdateParam input = new VolumeGroupUpdateParam();
    input.setAddHostsList(hostIds);
    TaskList taskList = getClient().application().updateApplication(mobilityGroupId, input);
    return new Tasks<TaskResourceRep>(getClient().auth().getClient(), taskList.getTaskList(), TaskResourceRep.class);
}
Also used : WaitForTasks(com.emc.sa.service.vipr.tasks.WaitForTasks) Tasks(com.emc.vipr.client.Tasks) TaskList(com.emc.storageos.model.TaskList) VolumeGroupUpdateParam(com.emc.storageos.model.application.VolumeGroupUpdateParam)

Example 28 with Tasks

use of com.emc.vipr.client.Tasks in project coprhd-controller by CoprHD.

the class ChangeBlockVolumeVirtualPoolNoWait method executeTask.

@Override
public Tasks<VolumeRestRep> executeTask() throws Exception {
    Tasks<VolumeRestRep> result = new Tasks<VolumeRestRep>(getClient().auth().getClient(), null, VolumeRestRep.class);
    // One request per virtual pool
    for (URI vpool : volumeIds.keySet()) {
        if (!vpool.equals(targetVirtualPoolId)) {
            VolumeVirtualPoolChangeParam input = new VolumeVirtualPoolChangeParam();
            input.setVolumes(Lists.newArrayList(volumeIds.get(vpool)));
            input.setVirtualPool(targetVirtualPoolId);
            try {
                Tasks<VolumeRestRep> tasks = getClient().blockVolumes().changeVirtualPool(input);
                for (Task<VolumeRestRep> task : tasks.getTasks()) {
                    addOrderIdTag(task.getTaskResource().getId());
                }
                result.getTasks().addAll(tasks.getTasks());
            } catch (ServiceErrorException ex) {
                logError(ex.getMessage());
            }
        }
    }
    return result;
}
Also used : Tasks(com.emc.vipr.client.Tasks) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) VolumeVirtualPoolChangeParam(com.emc.storageos.model.block.VolumeVirtualPoolChangeParam) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException) URI(java.net.URI)

Example 29 with Tasks

use of com.emc.vipr.client.Tasks in project coprhd-controller by CoprHD.

the class IngestExportedUnmanagedVolumes method executeChunks.

private Tasks<UnManagedVolumeRestRep> executeChunks(VolumeExportIngestParam ingest) {
    Tasks<UnManagedVolumeRestRep> results = new Tasks<UnManagedVolumeRestRep>(getClient().auth().getClient(), null, UnManagedVolumeRestRep.class);
    int i = 0;
    Iterator<URI> ids = unmanagedVolumeIds.iterator();
    while (ids.hasNext()) {
        i++;
        URI id = ids.next();
        ingest.getUnManagedVolumes().add(id);
        if (i == INGEST_CHUNK_SIZE || !ids.hasNext()) {
            Tasks<UnManagedVolumeRestRep> currentChunk = ingestVolumes(ingest);
            results.getTasks().addAll(currentChunk.getTasks());
            processBatch(currentChunk, i);
            ingest.getUnManagedVolumes().clear();
            i = 0;
        }
    }
    return results;
}
Also used : WaitForTasks(com.emc.sa.service.vipr.tasks.WaitForTasks) Tasks(com.emc.vipr.client.Tasks) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) URI(java.net.URI)

Aggregations

Tasks (com.emc.vipr.client.Tasks)29 TaskList (com.emc.storageos.model.TaskList)27 WaitForTasks (com.emc.sa.service.vipr.tasks.WaitForTasks)24 VolumeGroupUpdateParam (com.emc.storageos.model.application.VolumeGroupUpdateParam)8 URI (java.net.URI)8 VolumeGroupSnapshotOperationParam (com.emc.storageos.model.application.VolumeGroupSnapshotOperationParam)4 VolumeGroupVolumeList (com.emc.storageos.model.application.VolumeGroupUpdateParam.VolumeGroupVolumeList)4 VolumeGroupFullCopyDetachParam (com.emc.storageos.model.application.VolumeGroupFullCopyDetachParam)2 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)2 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 VolumeGroupFullCopyCreateParam (com.emc.storageos.model.application.VolumeGroupFullCopyCreateParam)1 VolumeGroupFullCopyRestoreParam (com.emc.storageos.model.application.VolumeGroupFullCopyRestoreParam)1 VolumeGroupFullCopyResynchronizeParam (com.emc.storageos.model.application.VolumeGroupFullCopyResynchronizeParam)1 VolumeGroupSnapshotCreateParam (com.emc.storageos.model.application.VolumeGroupSnapshotCreateParam)1 VolumeGroupSnapshotSessionCreateParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionCreateParam)1 VolumeGroupSnapshotSessionDeactivateParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionDeactivateParam)1 VolumeGroupSnapshotSessionLinkTargetsParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionLinkTargetsParam)1 VolumeGroupSnapshotSessionRelinkTargetsParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionRelinkTargetsParam)1 VolumeGroupSnapshotSessionRestoreParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionRestoreParam)1 VolumeGroupSnapshotSessionUnlinkTargetsParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionUnlinkTargetsParam)1