use of com.emc.storageos.model.application.VolumeGroupCopySetParam 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.application.VolumeGroupCopySetParam in project coprhd-controller by CoprHD.
the class BlockProvider method getReplicationGroupsForApplicationFullCopy.
protected Set<String> getReplicationGroupsForApplicationFullCopy(ViPRCoreClient client, URI applicationId, String copySet) {
Set<String> options = Sets.newHashSet();
VolumeGroupCopySetParam input = new VolumeGroupCopySetParam();
input.setCopySetName(copySet);
NamedVolumesList fullCopies = client.application().getVolumeGroupFullCopiesForSet(applicationId, input);
for (NamedRelatedResourceRep fullCopy : fullCopies.getVolumes()) {
VolumeRestRep fullCopyRep = client.blockVolumes().get(fullCopy);
if (fullCopyRep != null && fullCopyRep.getReplicationGroupInstance() != null) {
options.add(fullCopyRep.getReplicationGroupInstance());
}
}
return options;
}
use of com.emc.storageos.model.application.VolumeGroupCopySetParam in project coprhd-controller by CoprHD.
the class BlockProvider method getApplicationSnapshotSessionCopySetsForRestore.
private Set<String> getApplicationSnapshotSessionCopySetsForRestore(AssetOptionsContext ctx, URI application) {
Set<String> restoreCopySets = new HashSet<String>();
Set<String> copySetNames = api(ctx).application().getVolumeGroupSnapsetSessionSets(application).getCopySets();
boolean isRP = false;
NamedVolumesList volsInApp = api(ctx).application().getVolumeByApplication(application);
if (volsInApp != null && volsInApp.getVolumes() != null && !volsInApp.getVolumes().isEmpty()) {
VolumeRestRep firstVol = api(ctx).blockVolumes().get(volsInApp.getVolumes().get(0).getId());
isRP = BlockStorageUtils.isRPVolume(firstVol);
}
if (isRP) {
List<VolumeRestRep> applicationVolumes = api(ctx).blockVolumes().getByRefs(api(ctx).application().getVolumeByApplication(application).getVolumes());
Set<String> sourceRepGrpNames = new HashSet<String>();
for (VolumeRestRep volume : applicationVolumes) {
if (volume.getReplicationGroupInstance() != null && BlockStorageUtils.isRPSourceVolume(volume)) {
sourceRepGrpNames.add(volume.getReplicationGroupInstance());
}
}
for (String copySetName : copySetNames) {
VolumeGroupCopySetParam input = new VolumeGroupCopySetParam();
input.setCopySetName(copySetName);
BlockSnapshotSessionList sessions = api(ctx).application().getVolumeGroupSnapshotSessionsByCopySet(application, input);
if (sessions != null && sessions.getSnapSessionRelatedResourceList() != null && !sessions.getSnapSessionRelatedResourceList().isEmpty()) {
BlockSnapshotSessionRestRep sessionRep = api(ctx).blockSnapshotSessions().get(sessions.getSnapSessionRelatedResourceList().get(0));
if (sessionRep != null && sessionRep.getReplicationGroupInstance() != null && sourceRepGrpNames.contains(sessionRep.getReplicationGroupInstance())) {
restoreCopySets.add(copySetName);
}
}
}
} else {
restoreCopySets.addAll(copySetNames);
}
return restoreCopySets;
}
use of com.emc.storageos.model.application.VolumeGroupCopySetParam in project coprhd-controller by CoprHD.
the class BlockProvider method getApplicationSnapshotCopySetsForRestore.
private Set<String> getApplicationSnapshotCopySetsForRestore(AssetOptionsContext ctx, URI application) {
Set<String> restoreCopySets = new HashSet<String>();
Set<String> copySetNames = api(ctx).application().getVolumeGroupSnapshotSets(application).getCopySets();
boolean isRP = false;
NamedVolumesList volsInApp = api(ctx).application().getVolumeByApplication(application);
if (volsInApp != null && volsInApp.getVolumes() != null && !volsInApp.getVolumes().isEmpty()) {
VolumeRestRep firstVol = api(ctx).blockVolumes().get(volsInApp.getVolumes().get(0).getId());
isRP = BlockStorageUtils.isRPVolume(firstVol);
}
if (isRP) {
for (String copySetName : copySetNames) {
VolumeGroupCopySetParam input = new VolumeGroupCopySetParam();
input.setCopySetName(copySetName);
SnapshotList snapshots = api(ctx).application().getVolumeGroupSnapshotsForSet(application, input);
if (snapshots != null && snapshots.getSnapList() != null && !snapshots.getSnapList().isEmpty()) {
BlockSnapshotRestRep snapRep = api(ctx).blockSnapshots().get(snapshots.getSnapList().get(0));
if (snapRep != null) {
VolumeRestRep parentVol = api(ctx).blockVolumes().get(snapRep.getParent());
if (BlockStorageUtils.isRPSourceVolume(parentVol)) {
restoreCopySets.add(copySetName);
}
}
}
}
} else {
restoreCopySets.addAll(copySetNames);
}
return restoreCopySets;
}
use of com.emc.storageos.model.application.VolumeGroupCopySetParam in project coprhd-controller by CoprHD.
the class GetBlockSnapshotSet method executeTask.
@Override
public SnapshotList executeTask() throws Exception {
VolumeGroupCopySetParam setParam = new VolumeGroupCopySetParam();
setParam.setCopySetName(copySet);
return getClient().application().getVolumeGroupSnapshotsForSet(applicationId, setParam);
}
Aggregations