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);
}
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();
}
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;
}
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;
}
Aggregations