Search in sources :

Example 1 with Task

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

the class BlockConsistencyGroups method consistencyGroupDetails.

public static void consistencyGroupDetails(String consistencyGroupId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    AffectedResources.BlockConsistencyGroupDetails blockConsistencyGroup = new AffectedResources.BlockConsistencyGroupDetails(uri(consistencyGroupId));
    if (blockConsistencyGroup.blockConsistencyGroup == null) {
        flash.error(MessagesUtils.get(UNKNOWN, consistencyGroupId));
        ConsistencyGroups.list();
    }
    Tasks<BlockConsistencyGroupRestRep> tasksResponse = client.blockConsistencyGroups().getTasks(blockConsistencyGroup.blockConsistencyGroup.getId());
    List<Task<BlockConsistencyGroupRestRep>> tasks = tasksResponse.getTasks();
    renderArgs.put("tasks", tasks);
    List<VolumeRestRep> volumes = blockConsistencyGroup.volumes;
    Map<URI, String> virtualArrays = ResourceUtils.mapNames(client.varrays().list());
    Map<URI, String> virtualPools = ResourceUtils.mapNames(client.blockVpools().list());
    List<Volume> volumeDetails = Lists.newArrayList();
    for (VolumeRestRep volume : volumes) {
        volumeDetails.add(new Volume(volume, virtualArrays, virtualPools));
    }
    render(blockConsistencyGroup, volumeDetails);
}
Also used : Task(com.emc.vipr.client.Task) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockConsistencyGroupRestRep(com.emc.storageos.model.block.BlockConsistencyGroupRestRep) URI(java.net.URI) Volume(models.datatable.BlockVolumesDataTable.Volume) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep)

Example 2 with Task

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

the class BlockSnapshotSessions method snapshotSessionDetails.

public static void snapshotSessionDetails(String snapshotSessionId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    AffectedResources.BlockSnapshotSessionDetails blockSnapshotSession = new AffectedResources.BlockSnapshotSessionDetails(uri(snapshotSessionId));
    if (blockSnapshotSession.blockSnapshotSession == null) {
        flash.error(MessagesUtils.get(UNKNOWN, snapshotSessionId));
        snapshotSessions(null);
    }
    if (blockSnapshotSession.volume != null) {
        AffectedResources.VolumeDetails volume = new AffectedResources.VolumeDetails(blockSnapshotSession.volume.getId());
        renderArgs.put("volume", volume);
    }
    List<Task<BlockSnapshotSessionRestRep>> tasks = null;
    if (blockSnapshotSession.blockSnapshotSession != null) {
        Tasks<BlockSnapshotSessionRestRep> tasksResponse = client.blockSnapshotSessions().getTasks(blockSnapshotSession.blockSnapshotSession.getId());
        tasks = tasksResponse.getTasks();
    }
    render(blockSnapshotSession, tasks);
}
Also used : Task(com.emc.vipr.client.Task) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep)

Example 3 with Task

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

the class FileSystems method delete.

private static void delete(List<URI> ids, String deleteType) {
    if (ids != null) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        List<Task<FileShareRestRep>> tasks = Lists.newArrayList();
        for (URI id : ids) {
            boolean forceDelete = false;
            Task<FileShareRestRep> task = client.fileSystems().deactivate(id, new FileSystemDeleteParam(forceDelete, deleteType));
            tasks.add(task);
        }
        if (!tasks.isEmpty()) {
            flash.put("info", MessagesUtils.get("resources.filesystems.deactivate", tasks.size()));
        }
    }
    fileSystems(null);
}
Also used : Task(com.emc.vipr.client.Task) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) FileSystemDeleteParam(com.emc.storageos.model.file.FileSystemDeleteParam) URI(java.net.URI)

Example 4 with Task

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

the class ObjectBuckets method delete.

private static void delete(List<URI> ids, String deleteType) {
    if (ids != null) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        List<Task<BucketRestRep>> tasks = Lists.newArrayList();
        for (URI id : ids) {
            boolean forceDelete = false;
            Task<BucketRestRep> task = client.objectBuckets().deactivate(id, new BucketDeleteParam(forceDelete, deleteType));
            tasks.add(task);
        }
        if (!tasks.isEmpty()) {
            flash.put("info", MessagesUtils.get("resources.buckets.deactivate", tasks.size()));
        }
    }
    buckets(null);
}
Also used : Task(com.emc.vipr.client.Task) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BucketRestRep(com.emc.storageos.model.object.BucketRestRep) BucketDeleteParam(com.emc.storageos.model.object.BucketDeleteParam) URI(java.net.URI)

Example 5 with Task

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

the class BlockVolumes method deactivate.

/**
 * Begins deactivating a block volume by ID.
 * <p>
 * API Call: <tt>POST /block/volumes/{id}/deactivate?type={deletionType}</tt>
 *
 * @param id
 *            the ID of the block volume to deactivate.
 * @param deletionType
 *            {@code FULL} or {@code VIPR_ONLY}
 * @return a task for monitoring the progress of the operation.
 *
 * @see com.emc.storageos.model.block.VolumeDeleteTypeEnum
 */
public Task<VolumeRestRep> deactivate(URI id, VolumeDeleteTypeEnum deletionType) {
    URI uri = client.uriBuilder(getDeactivateUrl()).queryParam("type", deletionType).build(id);
    TaskResourceRep task = client.postURI(TaskResourceRep.class, uri);
    return new Task<>(client, task, resourceClass);
}
Also used : Task(com.emc.vipr.client.Task) TaskResourceRep(com.emc.storageos.model.TaskResourceRep) URI(java.net.URI)

Aggregations

Task (com.emc.vipr.client.Task)21 URI (java.net.URI)13 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)11 ArrayList (java.util.ArrayList)6 ExecutionException (com.emc.sa.engine.ExecutionException)5 DeactivateHost (com.emc.sa.service.vipr.compute.tasks.DeactivateHost)5 DiscoverHost (com.emc.sa.service.vipr.compute.tasks.DiscoverHost)5 GetHost (com.emc.sa.service.vipr.tasks.GetHost)5 Host (com.emc.storageos.db.client.model.Host)5 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)4 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)4 TimeoutException (com.emc.vipr.client.exceptions.TimeoutException)4 ViPRException (com.emc.vipr.client.exceptions.ViPRException)4 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)4 HashMap (java.util.HashMap)4 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)3 FileSnapshotRestRep (com.emc.storageos.model.file.FileSnapshotRestRep)3 HostRestRep (com.emc.storageos.model.host.HostRestRep)3 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)2 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)2