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