Search in sources :

Example 11 with BlockSnapshotSessionRestRep

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

the class BlockProvider method constructSnapshotSessionOptions.

protected List<AssetOption> constructSnapshotSessionOptions(ViPRCoreClient client, URI project, List<BlockSnapshotSessionRestRep> snapshotSessions) {
    List<AssetOption> options = Lists.newArrayList();
    Map<URI, VolumeRestRep> volumeNames = getProjectVolumeNames(client, project);
    for (BlockSnapshotSessionRestRep snapshotSession : snapshotSessions) {
        options.add(new AssetOption(snapshotSession.getId(), getBlockObjectLabel(client, snapshotSession, volumeNames)));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Example 12 with BlockSnapshotSessionRestRep

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

the class BlockProvider method getLinkedSnapshotsForApplicationSnapshotSessionVolumeNew.

@Asset("linkedSnapshotsForApplicationSnapshotSessionLinkService")
@AssetDependencies({ "application", "applicationSnapshotSessionCopySets" })
public List<AssetOption> getLinkedSnapshotsForApplicationSnapshotSessionVolumeNew(AssetOptionsContext ctx, URI application, String selectedCopySet) {
    ViPRCoreClient client = api(ctx);
    List<BlockSnapshotRestRep> snapshots = new ArrayList<BlockSnapshotRestRep>();
    Set<String> replicationGroups = getReplicationGroupsForApplicationSnapshotSession(client, application, selectedCopySet);
    Set<String> copySets = client.application().getVolumeGroupSnapsetSessionSets(application).getCopySets();
    List<BlockSnapshotSessionRestRep> snapshotSessions = Lists.newArrayList();
    for (String copySet : copySets) {
        VolumeGroupCopySetParam param = new VolumeGroupCopySetParam();
        param.setCopySetName(copySet);
        BlockSnapshotSessionList snapshotSessionList = client.application().getVolumeGroupSnapshotSessionsByCopySet(application, param);
        List<BlockSnapshotSessionRestRep> snapshotSessionsTmp = client.blockSnapshotSessions().getByRefs(snapshotSessionList.getSnapSessionRelatedResourceList());
        snapshotSessions.addAll(snapshotSessionsTmp);
        for (BlockSnapshotSessionRestRep session : snapshotSessionsTmp) {
            if (replicationGroups.contains(BlockStorageUtils.stripRPTargetFromReplicationGroup(session.getReplicationGroupInstance()))) {
                for (RelatedResourceRep target : session.getLinkedTarget()) {
                    BlockSnapshotRestRep blockSnapshot = client.blockSnapshots().get(target);
                    snapshots.add(blockSnapshot);
                }
            }
        }
    }
    return constructSnapshotWithSnapshotSessionOptions(snapshots, snapshotSessions);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep) VolumeGroupCopySetParam(com.emc.storageos.model.application.VolumeGroupCopySetParam) ArrayList(java.util.ArrayList) BlockSnapshotSessionList(com.emc.storageos.model.block.BlockSnapshotSessionList) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 13 with BlockSnapshotSessionRestRep

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

the class BlockProvider method getLinkedSnapshotsForApplicationSnapshotSessionVolume.

@Asset("linkedSnapshotsForApplicationSnapshotSession")
@AssetDependencies({ "application", "applicationSnapshotSessionCopySets" })
public List<AssetOption> getLinkedSnapshotsForApplicationSnapshotSessionVolume(AssetOptionsContext ctx, URI application, String copySet) {
    List<BlockSnapshotRestRep> snapshots = new ArrayList<BlockSnapshotRestRep>();
    VolumeGroupCopySetParam param = new VolumeGroupCopySetParam();
    param.setCopySetName(copySet);
    BlockSnapshotSessionList snapshotSessionList = api(ctx).application().getVolumeGroupSnapshotSessionsByCopySet(application, param);
    List<BlockSnapshotSessionRestRep> snapshotSessions = api(ctx).blockSnapshotSessions().getByRefs(snapshotSessionList.getSnapSessionRelatedResourceList());
    for (BlockSnapshotSessionRestRep session : snapshotSessions) {
        for (RelatedResourceRep target : session.getLinkedTarget()) {
            BlockSnapshotRestRep blockSnapshot = api(ctx).blockSnapshots().get(target);
            snapshots.add(blockSnapshot);
        }
    }
    return constructSnapshotWithSnapshotSessionOptions(snapshots, snapshotSessions);
}
Also used : BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep) VolumeGroupCopySetParam(com.emc.storageos.model.application.VolumeGroupCopySetParam) ArrayList(java.util.ArrayList) BlockSnapshotSessionList(com.emc.storageos.model.block.BlockSnapshotSessionList) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 14 with BlockSnapshotSessionRestRep

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

the class BlockStorageUtils method getSingleSnapshotSessionPerSubGroupAndStorageSystem.

public static List<URI> getSingleSnapshotSessionPerSubGroupAndStorageSystem(URI applicationId, String copySet, List<String> subGroups) {
    List<URI> snapshotSessionIds = Lists.newArrayList();
    Table<URI, String, BlockSnapshotSessionRestRep> results = getReplicationGroupSnapshotSessions(execute(new GetBlockSnapshotSessionList(applicationId, copySet)).getSnapSessionRelatedResourceList());
    for (Cell<URI, String, BlockSnapshotSessionRestRep> cell : results.cellSet()) {
        String stripped = BlockStorageUtils.stripRPTargetFromReplicationGroup(cell.getColumnKey());
        if (subGroups.contains(stripped)) {
            snapshotSessionIds.add(cell.getValue().getId());
        }
    }
    return snapshotSessionIds;
}
Also used : BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) GetBlockSnapshotSessionList(com.emc.sa.service.vipr.application.tasks.GetBlockSnapshotSessionList) URI(java.net.URI)

Example 15 with BlockSnapshotSessionRestRep

use of com.emc.storageos.model.block.BlockSnapshotSessionRestRep 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)

Aggregations

BlockSnapshotSessionRestRep (com.emc.storageos.model.block.BlockSnapshotSessionRestRep)20 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)9 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)8 URI (java.net.URI)8 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)5 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)5 ArrayList (java.util.ArrayList)5 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)4 VolumeGroupCopySetParam (com.emc.storageos.model.application.VolumeGroupCopySetParam)4 BlockSnapshotSessionList (com.emc.storageos.model.block.BlockSnapshotSessionList)4 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)4 Asset (com.emc.sa.asset.annotation.Asset)3 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)3 DeactivateBlockSnapshotSession (com.emc.sa.service.vipr.block.tasks.DeactivateBlockSnapshotSession)2 AssetOption (com.emc.vipr.model.catalog.AssetOption)2 GetBlockSnapshotSession (com.emc.sa.service.vipr.application.tasks.GetBlockSnapshotSession)1 GetBlockSnapshotSessionList (com.emc.sa.service.vipr.application.tasks.GetBlockSnapshotSessionList)1 DeactivateBlockSnapshot (com.emc.sa.service.vipr.block.tasks.DeactivateBlockSnapshot)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 BlockSnapshotSession (com.emc.storageos.db.client.model.BlockSnapshotSession)1