Search in sources :

Example 1 with VolumeGroupCopySetParam

use of com.emc.storageos.model.application.VolumeGroupCopySetParam 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 2 with VolumeGroupCopySetParam

use of com.emc.storageos.model.application.VolumeGroupCopySetParam 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 3 with VolumeGroupCopySetParam

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

the class BlockProvider method getReplicationGroupsForApplicationSnapshot.

protected Set<String> getReplicationGroupsForApplicationSnapshot(ViPRCoreClient client, URI applicationId, String copySet) {
    Set<String> options = Sets.newHashSet();
    VolumeGroupCopySetParam input = new VolumeGroupCopySetParam();
    input.setCopySetName(copySet);
    SnapshotList sessions = client.application().getVolumeGroupSnapshotsForSet(applicationId, input);
    for (NamedRelatedResourceRep snap : sessions.getSnapList()) {
        BlockSnapshotRestRep snapRep = client.blockSnapshots().get(snap);
        // TODO get replication group from parent. should the snapshot already contain this?
        VolumeRestRep parentVolume = client.blockVolumes().get(snapRep.getParent());
        if (parentVolume != null && parentVolume.getReplicationGroupInstance() != null) {
            options.add(parentVolume.getReplicationGroupInstance());
        }
    }
    return BlockStorageUtils.stripRPTargetFromReplicationGroup(options);
}
Also used : SnapshotList(com.emc.storageos.model.SnapshotList) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) VolumeGroupCopySetParam(com.emc.storageos.model.application.VolumeGroupCopySetParam) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep)

Example 4 with VolumeGroupCopySetParam

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

the class AppSupportUtil method getVolumeGroupSnapshotsForSet.

public static List<NamedRelatedResourceRep> getVolumeGroupSnapshotsForSet(String id, String snapSet) {
    VolumeGroupCopySetParam newParam = new VolumeGroupCopySetParam();
    newParam.setCopySetName(snapSet);
    return BourneUtil.getViprClient().application().getVolumeGroupSnapshotsForSet(uri(id), newParam).getSnapList();
}
Also used : VolumeGroupCopySetParam(com.emc.storageos.model.application.VolumeGroupCopySetParam)

Example 5 with VolumeGroupCopySetParam

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

the class AppSupportUtil method getVolumeGroupSnapshotSessionsByCopySet.

public static List<NamedRelatedResourceRep> getVolumeGroupSnapshotSessionsByCopySet(String id, String sessionSet) {
    VolumeGroupCopySetParam snapshotSessionSet = new VolumeGroupCopySetParam();
    snapshotSessionSet.setCopySetName(sessionSet);
    return BourneUtil.getViprClient().application().getVolumeGroupSnapshotSessionsByCopySet(uri(id), snapshotSessionSet).getSnapSessionRelatedResourceList();
}
Also used : VolumeGroupCopySetParam(com.emc.storageos.model.application.VolumeGroupCopySetParam)

Aggregations

VolumeGroupCopySetParam (com.emc.storageos.model.application.VolumeGroupCopySetParam)13 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)5 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)4 BlockSnapshotSessionList (com.emc.storageos.model.block.BlockSnapshotSessionList)4 BlockSnapshotSessionRestRep (com.emc.storageos.model.block.BlockSnapshotSessionRestRep)4 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)4 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)3 Asset (com.emc.sa.asset.annotation.Asset)2 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)2 SnapshotList (com.emc.storageos.model.SnapshotList)2 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)1