use of com.emc.sa.service.vipr.block.tasks.CreateBlockSnapshot in project coprhd-controller by CoprHD.
the class CreateBlockSnapshotService method execute.
@Override
public void execute() {
Tasks<? extends DataObjectRestRep> tasks = null;
if (ConsistencyUtils.isVolumeStorageType(storageType)) {
for (BlockObjectRestRep volume : volumes) {
checkAndPurgeObsoleteSnapshots(volume.getId().toString());
if (BlockProvider.SNAPSHOT_SESSION_TYPE_VALUE.equals(type)) {
tasks = execute(new CreateBlockSnapshotSession(volume.getId(), nameParam, linkedSnapshotName, linkedSnapshotCount, linkedSnapshotCopyMode));
} else {
tasks = execute(new CreateBlockSnapshot(volume.getId(), type, nameParam, readOnly));
}
addAffectedResources(tasks);
addRetainedReplicas(volume.getId(), tasks.getTasks());
}
} else {
for (String consistencyGroupId : volumeIds) {
checkAndPurgeObsoleteSnapshots(consistencyGroupId);
if (BlockProvider.CG_SNAPSHOT_SESSION_TYPE_VALUE.equals(type)) {
tasks = ConsistencyUtils.createSnapshotSession(uri(consistencyGroupId), nameParam, linkedSnapshotName, linkedSnapshotCount, linkedSnapshotCopyMode);
} else {
tasks = ConsistencyUtils.createSnapshot(uri(consistencyGroupId), nameParam, readOnly);
}
addAffectedResources(tasks);
addRetainedReplicas(uri(consistencyGroupId), tasks.getTasks());
}
}
}
Aggregations