Search in sources :

Example 11 with VolumeRestRep

use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.

the class BlockApplications method applicationVolumeJson.

public static void applicationVolumeJson(String id) {
    List<VolumeApplication> volumeDetails = Lists.newArrayList();
    List<NamedRelatedResourceRep> volumes = AppSupportUtil.getVolumesByApplication(id);
    Map<URI, String> virtualArrays = ResourceUtils.mapNames(BourneUtil.getViprClient().varrays().list());
    Map<URI, String> virtualPools = ResourceUtils.mapNames(BourneUtil.getViprClient().blockVpools().list());
    for (NamedRelatedResourceRep volume : volumes) {
        VolumeRestRep blockVolume = BourneUtil.getViprClient().blockVolumes().get((volume.getId()));
        volumeDetails.add(new VolumeApplication(blockVolume, virtualArrays, virtualPools));
    }
    renderJSON(DataTablesSupport.createJSON(volumeDetails, params));
}
Also used : NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) VolumeApplication(controllers.resources.BlockApplications.VolumeApplicationDataTable.VolumeApplication) URI(java.net.URI)

Example 12 with VolumeRestRep

use of com.emc.storageos.model.block.VolumeRestRep 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 13 with VolumeRestRep

use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.

the class MobilityGroupMigrationService method mapVpoolVolumes.

/**
 * Get map of virtual pool id to list of volumes in the virtual pool
 *
 * @return map of virtual pool to volumes
 */
private Map<URI, Set<URI>> mapVpoolVolumes() {
    Set<URI> volumes = getVolumes();
    Map<URI, Set<URI>> vpoolVolumes = Maps.newHashMap();
    for (URI volume : volumes) {
        VolumeRestRep vol = getClient().blockVolumes().get(volume);
        if (!vpoolVolumes.containsKey(vol.getVirtualPool().getId())) {
            vpoolVolumes.put(vol.getVirtualPool().getId(), new HashSet<URI>());
        }
        vpoolVolumes.get(vol.getVirtualPool().getId()).add(vol.getId());
    }
    return vpoolVolumes;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) URI(java.net.URI)

Example 14 with VolumeRestRep

use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.

the class DeleteVmfsDatastoreAndVolumeService method precheck.

@Override
public void precheck() throws Exception {
    super.precheck();
    datastores = Maps.newHashMap();
    acquireHostLock();
    for (String datastoreName : datastoreNames) {
        Datastore datastore = vmware.getDatastore(datacenter.getLabel(), datastoreName);
        vmware.verifyDatastoreForRemoval(datastore);
        List<VolumeRestRep> volumes = vmware.verifyVolumesBackingDatastore(host, hostId, datastore);
        datastores.put(datastore, volumes);
    }
}
Also used : Datastore(com.vmware.vim25.mo.Datastore) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep)

Example 15 with VolumeRestRep

use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.

the class BlockSnapshotSessionsDataTable method fetch.

public static List<BlockSnapshotSession> fetch(URI projectId) {
    if (projectId == null) {
        return Collections.emptyList();
    }
    ViPRCoreClient client = getViprClient();
    List<BlockSnapshotSessionRestRep> blockSnapshots = client.blockSnapshotSessions().findByProject(projectId);
    Map<URI, VolumeRestRep> parentVolumes = getParentVolumes(blockSnapshots);
    List<BlockSnapshotSession> results = Lists.newArrayList();
    for (BlockSnapshotSessionRestRep blockSnapshot : blockSnapshots) {
        BlockSnapshotSession snap = new BlockSnapshotSession(blockSnapshot);
        // Get the parent volume of the snapshot
        VolumeRestRep volume = parentVolumes.get(ResourceUtils.id(blockSnapshot.getParent()));
        snap.volume = ResourceUtils.name(volume);
        results.add(snap);
    }
    return results;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) BlockSnapshotSession(com.emc.storageos.db.client.model.BlockSnapshotSession) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Aggregations

VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)136 URI (java.net.URI)74 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)49 Asset (com.emc.sa.asset.annotation.Asset)35 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)35 ArrayList (java.util.ArrayList)25 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)23 AssetOption (com.emc.vipr.model.catalog.AssetOption)20 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)13 HashSet (java.util.HashSet)13 UnManagedVolumeRestRep (com.emc.storageos.model.block.UnManagedVolumeRestRep)12 Test (org.junit.Test)12 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)11 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)10 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)9 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)8 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)7 VolumeCreate (com.emc.storageos.model.block.VolumeCreate)7 List (java.util.List)7 SnapshotList (com.emc.storageos.model.SnapshotList)6