Search in sources :

Example 1 with CreateBlockSnapshotSession

use of com.emc.sa.service.vipr.block.tasks.CreateBlockSnapshotSession 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());
        }
    }
}
Also used : CreateBlockSnapshot(com.emc.sa.service.vipr.block.tasks.CreateBlockSnapshot) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep) CreateBlockSnapshotSession(com.emc.sa.service.vipr.block.tasks.CreateBlockSnapshotSession)

Aggregations

CreateBlockSnapshot (com.emc.sa.service.vipr.block.tasks.CreateBlockSnapshot)1 CreateBlockSnapshotSession (com.emc.sa.service.vipr.block.tasks.CreateBlockSnapshotSession)1 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)1