use of com.emc.storageos.volumecontroller.impl.vnxunity.job.VNXUnityRestoreSnapshotJob in project coprhd-controller by CoprHD.
the class VNXUnitySnapshotOperations method restoreGroupSnapshots.
@Override
public void restoreGroupSnapshots(StorageSystem storage, URI volume, URI snapshot, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
VNXeApiClient apiClient = getVnxeClient(storage);
Snap groupSnap = apiClient.getSnapshot(snapshotObj.getReplicationGroupInstance());
Snap snap = apiClient.getSnapshot(snapshotObj.getNativeId());
// Error out if the snapshot is attached
if (snap.isAttached()) {
log.error("Snapshot {})is exported and cannot be used for restore", snapshotObj.getLabel());
ServiceError error = DeviceControllerErrors.vnxe.cannotRestoreAttachedSnapshot(snapshotObj.getLabel());
taskCompleter.error(_dbClient, error);
}
VNXeCommandJob job = apiClient.restoreSnap(groupSnap.getId());
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new VNXUnityRestoreSnapshotJob(job.getId(), storage.getId(), taskCompleter)));
}
} catch (Exception ex) {
log.error("Restore group snapshot got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("RestoreSnapshotJob", ex.getMessage());
taskCompleter.error(_dbClient, error);
}
}
use of com.emc.storageos.volumecontroller.impl.vnxunity.job.VNXUnityRestoreSnapshotJob in project coprhd-controller by CoprHD.
the class VNXUnitySnapshotOperations method restoreSingleVolumeSnapshot.
@Override
public void restoreSingleVolumeSnapshot(StorageSystem storage, URI volume, URI snapshot, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
VNXeApiClient apiClient = getVnxeClient(storage);
Snap snap = apiClient.getSnapshot(snapshotObj.getNativeId());
// Error out if the snapshot is attached
if (snap.isAttached()) {
log.error("Snapshot {})is exported and cannot be used for restore, please unexport it first", snapshotObj.getLabel());
ServiceError error = DeviceControllerErrors.vnxe.cannotRestoreAttachedSnapshot(snapshotObj.getLabel());
taskCompleter.error(_dbClient, error);
}
VNXeCommandJob job = apiClient.restoreSnap(snap.getId());
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new VNXUnityRestoreSnapshotJob(job.getId(), storage.getId(), taskCompleter)));
}
} catch (Exception ex) {
log.error("Restore snapshot got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("RestoreSnapshotJob", ex.getMessage());
taskCompleter.error(_dbClient, error);
}
}
Aggregations