Search in sources :

Example 6 with BlockSnapshotSessionList

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

the class BlockProvider method getReplicationGroupsForApplicationSnapshotSession.

protected Set<String> getReplicationGroupsForApplicationSnapshotSession(ViPRCoreClient client, URI applicationId, String copySet) {
    Set<String> options = Sets.newHashSet();
    VolumeGroupCopySetParam input = new VolumeGroupCopySetParam();
    input.setCopySetName(copySet);
    BlockSnapshotSessionList sessions = client.application().getVolumeGroupSnapshotSessionsByCopySet(applicationId, input);
    for (NamedRelatedResourceRep session : sessions.getSnapSessionRelatedResourceList()) {
        BlockSnapshotSessionRestRep sessionRep = client.blockSnapshotSessions().get(session);
        if (sessionRep != null && sessionRep.getReplicationGroupInstance() != null) {
            options.add(sessionRep.getReplicationGroupInstance());
        }
    }
    return BlockStorageUtils.stripRPTargetFromReplicationGroup(options);
}
Also used : BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) VolumeGroupCopySetParam(com.emc.storageos.model.application.VolumeGroupCopySetParam) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) BlockSnapshotSessionList(com.emc.storageos.model.block.BlockSnapshotSessionList)

Example 7 with BlockSnapshotSessionList

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

the class BlockConsistencyGroups method getSnapshotSessions.

/**
 * List snapshot sessions in the consistency group
 * <p>
 * API Call: <tt>GET /block/consistency-groups/{id}/protection/snapshot-sessions</tt>
 *
 * @param consistencyGroupId
 *            the ID of the consistency group
 * @return The list of snapshot sessions in the consistency group
 */
public List<NamedRelatedResourceRep> getSnapshotSessions(URI consistencyGroupId) {
    final String url = getIdUrl() + "/protection/snapshot-sessions";
    BlockSnapshotSessionList response = client.get(BlockSnapshotSessionList.class, url, consistencyGroupId);
    return response.getSnapSessionRelatedResourceList();
}
Also used : BlockSnapshotSessionList(com.emc.storageos.model.block.BlockSnapshotSessionList)

Example 8 with BlockSnapshotSessionList

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

the class BlockSnapshotSessionManager method getSnapshotSessionsForConsistencyGroup.

/**
 * @param group
 * @return
 */
public BlockSnapshotSessionList getSnapshotSessionsForConsistencyGroup(BlockConsistencyGroup group) {
    BlockSnapshotSessionList result = new BlockSnapshotSessionList();
    List<Volume> volumes = ControllerUtils.getVolumesPartOfCG(group.getId(), _dbClient);
    if (volumes.isEmpty()) {
        return result;
    }
    // if any of the source volumes are in an application, replica management must be done via the application
    for (Volume srcVol : volumes) {
        if (srcVol.getApplication(_dbClient) != null) {
            return result;
        }
    }
    Volume sourceVolume = volumes.get(0);
    // Get the platform specific block snapshot session implementation.
    BlockSnapshotSessionApi snapSessionApiImpl = determinePlatformSpecificImplForSource(sourceVolume);
    // Get the BlockSnapshotSession instances for the source and prepare the result.
    List<BlockSnapshotSession> snapSessions = snapSessionApiImpl.getSnapshotSessionsForConsistencyGroup(group);
    for (BlockSnapshotSession snapSession : snapSessions) {
        result.getSnapSessionRelatedResourceList().add(toNamedRelatedResource(snapSession));
    }
    return result;
}
Also used : BlockSnapshotSession(com.emc.storageos.db.client.model.BlockSnapshotSession) Volume(com.emc.storageos.db.client.model.Volume) BlockSnapshotSessionList(com.emc.storageos.model.block.BlockSnapshotSessionList)

Example 9 with BlockSnapshotSessionList

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

the class BlockSnapshotSessionManager method getSnapshotSessionsForSource.

/**
 * Get the BlockSnapshotSession instances for the source object with the passed URI.
 *
 * @param sourceURI The URI of the snapshot session source object.
 *
 * @return A BlockSnapshotSessionList of the snapshot sessions for the source.
 */
public BlockSnapshotSessionList getSnapshotSessionsForSource(URI sourceURI) {
    // Get the snapshot session source object.
    BlockObject sourceObj = BlockSnapshotSessionUtils.querySnapshotSessionSource(sourceURI, _uriInfo, true, _dbClient);
    // Get the platform specific block snapshot session implementation.
    BlockSnapshotSessionApi snapSessionApiImpl = determinePlatformSpecificImplForSource(sourceObj);
    // Get the BlockSnapshotSession instances for the source and prepare the result.
    List<BlockSnapshotSession> snapSessionsForSource = snapSessionApiImpl.getSnapshotSessionsForSource(sourceObj);
    BlockSnapshotSessionList result = new BlockSnapshotSessionList();
    for (BlockSnapshotSession snapSessionForSource : snapSessionsForSource) {
        result.getSnapSessionRelatedResourceList().add(toNamedRelatedResource(snapSessionForSource));
    }
    return result;
}
Also used : BlockSnapshotSession(com.emc.storageos.db.client.model.BlockSnapshotSession) BlockSnapshotSessionList(com.emc.storageos.model.block.BlockSnapshotSessionList) BlockObject(com.emc.storageos.db.client.model.BlockObject)

Aggregations

BlockSnapshotSessionList (com.emc.storageos.model.block.BlockSnapshotSessionList)9 BlockSnapshotSession (com.emc.storageos.db.client.model.BlockSnapshotSession)4 VolumeGroupCopySetParam (com.emc.storageos.model.application.VolumeGroupCopySetParam)4 BlockSnapshotSessionRestRep (com.emc.storageos.model.block.BlockSnapshotSessionRestRep)4 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)3 Asset (com.emc.sa.asset.annotation.Asset)2 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)2 VolumeGroup (com.emc.storageos.db.client.model.VolumeGroup)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)2 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)2 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)2 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)2 ArrayList (java.util.ArrayList)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 BlockObject (com.emc.storageos.db.client.model.BlockObject)1 Volume (com.emc.storageos.db.client.model.Volume)1 VolumeGroupCopySetList (com.emc.storageos.model.application.VolumeGroupCopySetList)1 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)1 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)1