Search in sources :

Example 56 with NamedRelatedResourceRep

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

the class BlockProvider method getApplicationVirtualArrays.

@Asset("applicationVirtualArray")
@AssetDependencies("application")
public List<AssetOption> getApplicationVirtualArrays(AssetOptionsContext ctx, URI applicationId) {
    final ViPRCoreClient client = api(ctx);
    List<NamedRelatedResourceRep> volList = client.application().listVolumes(applicationId);
    List<AssetOption> options = new ArrayList<AssetOption>();
    boolean isRP = false;
    URI sourceVarrayId = null;
    List<VolumeRestRep> allRPSourceVols = null;
    if (volList != null && !volList.isEmpty()) {
        VolumeRestRep vol = client.blockVolumes().get(volList.get(0));
        if (BlockProviderUtils.isVolumeRP(vol)) {
            isRP = true;
            allRPSourceVols = client.blockVolumes().getByRefs(volList, RecoverPointPersonalityFilter.SOURCE);
            if (allRPSourceVols != null && !allRPSourceVols.isEmpty()) {
                VolumeRestRep rpvol = allRPSourceVols.get(0);
                sourceVarrayId = rpvol.getVirtualArray().getId();
            }
        }
    } else {
        options.add(newAssetOption(URI.create("none"), "None"));
        return options;
    }
    // if the volumes are RP (vplex or not) add the RP targets as options
    if (isRP) {
        options.add(newAssetOption(sourceVarrayId, "protection.site.type.source"));
        Set<URI> targetVarrayIds = new HashSet<URI>();
        List<AssetOption> targetOptions = new ArrayList<AssetOption>();
        List<VolumeRestRep> allRPTargetVols = client.blockVolumes().getByRefs(volList, RecoverPointPersonalityFilter.TARGET);
        for (VolumeRestRep targetVol : allRPTargetVols) {
            targetVarrayIds.add(targetVol.getVirtualArray().getId());
        }
        List<VirtualArrayRestRep> targetVarrays = client.varrays().getByIds(targetVarrayIds);
        for (VirtualArrayRestRep targetVarray : targetVarrays) {
            targetOptions.add(newAssetOption(String.format("tgt:%s", targetVarray.getId().toString()), "protection.site.type.target", targetVarray.getName()));
        }
        // sort the targets
        AssetOptionsUtils.sortOptionsByLabel(targetOptions);
        options.addAll(targetOptions);
    }
    if (options.isEmpty()) {
        options.add(newAssetOption(URI.create("none"), "None"));
    }
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) HashSet(java.util.HashSet) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 57 with NamedRelatedResourceRep

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

the class ExportPathAdjustmentService method runExportPathsPreview.

private void runExportPathsPreview() {
    ExportPathsAdjustmentPreviewRestRep previewRestRep = execute(new ExportPathsPreview(host, virtualArray, exportId, minPaths, maxPaths, pathsPerInitiator, storageSystem, ports));
    List<InitiatorPortMapRestRep> affectedPaths = previewRestRep.getAdjustedPaths();
    List<InitiatorPortMapRestRep> removedPaths = previewRestRep.getRemovedPaths();
    // build the affected path
    for (InitiatorPortMapRestRep ipm : affectedPaths) {
        List<URI> portList = new ArrayList<URI>();
        for (NamedRelatedResourceRep port : ipm.getStoragePorts()) {
            portList.add(port.getId());
        }
        resultingPathsMap.put(ipm.getInitiator().getId(), portList);
    }
    // build the removed path
    for (InitiatorPortMapRestRep ipm : removedPaths) {
        List<URI> portList = new ArrayList<URI>();
        for (NamedRelatedResourceRep port : ipm.getStoragePorts()) {
            portList.add(port.getId());
        }
        removedPathsMap.put(ipm.getInitiator().getId(), portList);
    }
}
Also used : InitiatorPortMapRestRep(com.emc.storageos.model.block.export.InitiatorPortMapRestRep) ExportPathsAdjustmentPreviewRestRep(com.emc.storageos.model.block.export.ExportPathsAdjustmentPreviewRestRep) ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI) ExportPathsPreview(com.emc.sa.service.vipr.block.tasks.ExportPathsPreview)

Example 58 with NamedRelatedResourceRep

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

the class GetMobilityGroupVolumesByHost method getHostExportedVolumes.

private Set<URI> getHostExportedVolumes() {
    Set<URI> volumes = Sets.newHashSet();
    for (NamedRelatedResourceRep host : hosts) {
        List<ExportGroupRestRep> exports = getClient().blockExports().findContainingHost(host.getId());
        volumes.addAll(BlockProviderUtils.getExportedResourceIds(exports, ResourceType.VOLUME));
    }
    return volumes;
}
Also used : ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 59 with NamedRelatedResourceRep

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

the class BlockStorageUtils method getReplicationGroupSnapshotSessions.

public static Table<URI, String, BlockSnapshotSessionRestRep> getReplicationGroupSnapshotSessions(List<NamedRelatedResourceRep> volumeUris) {
    Table<URI, String, BlockSnapshotSessionRestRep> storageRgToVolumes = HashBasedTable.create();
    for (NamedRelatedResourceRep volumeUri : volumeUris) {
        BlockSnapshotSessionRestRep snapshotSession = execute(new GetBlockSnapshotSession(volumeUri.getId()));
        String rgName = snapshotSession.getReplicationGroupInstance();
        URI storage = snapshotSession.getStorageController();
        if (!storageRgToVolumes.contains(storage, rgName)) {
            storageRgToVolumes.put(storage, rgName, snapshotSession);
        }
    }
    return storageRgToVolumes;
}
Also used : BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI) GetBlockSnapshotSession(com.emc.sa.service.vipr.application.tasks.GetBlockSnapshotSession)

Example 60 with NamedRelatedResourceRep

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

the class BlockStorageUtils method getAllFullCopyVolumes.

public static List<URI> getAllFullCopyVolumes(URI applicationId, String copySet, List<String> subGroups) {
    List<URI> fullCopyIds = Lists.newArrayList();
    List<NamedRelatedResourceRep> fullCopies = execute(new GetFullCopyList(applicationId, copySet)).getVolumes();
    for (NamedRelatedResourceRep fullCopy : fullCopies) {
        fullCopyIds.add(fullCopy.getId());
    }
    return fullCopyIds;
}
Also used : GetFullCopyList(com.emc.sa.service.vipr.application.tasks.GetFullCopyList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Aggregations

NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)111 URI (java.net.URI)47 ArrayList (java.util.ArrayList)28 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)22 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)18 Asset (com.emc.sa.asset.annotation.Asset)11 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)11 AssetOption (com.emc.vipr.model.catalog.AssetOption)9 HashMap (java.util.HashMap)8 GET (javax.ws.rs.GET)8 Produces (javax.ws.rs.Produces)8 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)7 Path (javax.ws.rs.Path)7 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)6 NamedURI (com.emc.storageos.db.client.model.NamedURI)5 SnapshotList (com.emc.storageos.model.SnapshotList)5 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)5 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)5 HashSet (java.util.HashSet)5 List (java.util.List)5