use of com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeBlockDeleteSnapshotJob in project coprhd-controller by CoprHD.
the class VNXeSnapshotOperation method deleteGroupSnapshots.
@Override
public void deleteGroupSnapshots(StorageSystem storage, URI snapshot, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
List<BlockSnapshot> snapshots = _dbClient.queryObject(BlockSnapshot.class, Arrays.asList(snapshot));
BlockSnapshot snapshotObj = snapshots.get(0);
VNXeApiClient apiClient = getVnxeClient(storage);
VNXeLunGroupSnap lunGroupSnap = apiClient.getLunGroupSnapshot(snapshotObj.getReplicationGroupInstance());
if (lunGroupSnap != null) {
VNXeCommandJob job = apiClient.deleteLunGroupSnap(lunGroupSnap.getId());
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new VNXeBlockDeleteSnapshotJob(job.getId(), storage.getId(), taskCompleter)));
} else {
// Should not take this path, but treat as an error if we do
// happen to get a null job due to some error in the client.
_log.error("Unexpected null job from VNXe client call to delete group snapshot.");
ServiceCoded sc = DeviceControllerExceptions.vnxe.nullJobForDeleteGroupSnapshot(snapshotObj.forDisplay(), snapshotObj.getReplicationGroupInstance());
taskCompleter.error(_dbClient, sc);
}
} else {
// Treat as in the single volume snapshot case and presume
// the group snapshot has already been deleted.
List<BlockSnapshot> grpSnapshots = ControllerUtils.getSnapshotsPartOfReplicationGroup(snapshotObj, _dbClient);
for (BlockSnapshot grpSnapshot : grpSnapshots) {
grpSnapshot.setInactive(true);
grpSnapshot.setIsSyncActive(false);
}
_dbClient.updateObject(grpSnapshots);
taskCompleter.ready(_dbClient);
}
} catch (VNXeException e) {
_log.error("Delete group snapshot got the exception", e);
taskCompleter.error(_dbClient, e);
} catch (Exception ex) {
_log.error("Delete group snapshot got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeletGroupSnapshot", ex.getMessage());
taskCompleter.error(_dbClient, error);
}
}
use of com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeBlockDeleteSnapshotJob in project coprhd-controller by CoprHD.
the class VNXeSnapshotOperation method deleteSingleVolumeSnapshot.
@Override
public void deleteSingleVolumeSnapshot(StorageSystem storage, URI snapshot, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
BlockSnapshot snap = _dbClient.queryObject(BlockSnapshot.class, snapshot);
VNXeApiClient apiClient = getVnxeClient(storage);
VNXeLunSnap lunSnap = apiClient.getLunSnapshot(snap.getNativeId());
if (lunSnap != null) {
VNXeCommandJob job = apiClient.deleteLunSnap(lunSnap.getId());
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new VNXeBlockDeleteSnapshotJob(job.getId(), storage.getId(), taskCompleter)));
}
} else {
// Perhaps, it's already been deleted or was deleted on the array.
// In that case, we'll just say all is well, so that this operation
// is idempotent.
snap.setInactive(true);
snap.setIsSyncActive(false);
_dbClient.updateObject(snap);
taskCompleter.ready(_dbClient);
}
} catch (VNXeException e) {
_log.error("Delete volume snapshot got the exception", e);
taskCompleter.error(_dbClient, e);
} catch (Exception ex) {
_log.error("Delete volume snapshot got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeleteSnapshot", ex.getMessage());
taskCompleter.error(_dbClient, error);
}
}
Aggregations