use of com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeFSSnapshotTaskCompleter in project coprhd-controller by CoprHD.
the class FileOrchestrationDeviceController method restoreFS.
@Override
public void restoreFS(URI storage, URI fs, URI snapshot, String opId) throws ControllerException {
// Using VNXeFSSnapshotTaskCompleter as it will serve the purpose..
VNXeFSSnapshotTaskCompleter completer = new VNXeFSSnapshotTaskCompleter(Snapshot.class, snapshot, opId);
Workflow workflow = null;
try {
workflow = this._workflowService.getNewWorkflow(this, RESTORE_FILESYSTEM_SNAPSHOT_WF_NAME, false, opId, completer);
String restoreFSStep = workflow.createStepId();
String stepDescription = String.format("Restoring file System : %s from snapshot: %s", fs, snapshot);
Object[] args = new Object[] { storage, fs, snapshot };
_fileDeviceController.createMethod(workflow, null, RESTORE_FILESYSTEM_SNAPSHOT_METHOD, restoreFSStep, stepDescription, storage, args);
String successMessage = String.format("Restoring file system : %s from snapshot: %s finished successfully.", fs, snapshot);
workflow.executePlan(completer, successMessage);
} catch (Exception ex) {
s_logger.error(String.format("Restoring file system : %s from snapshot: %s failed.", fs, snapshot), ex);
String opName = ResourceOperationTypeEnum.RESTORE_FILE_SNAPSHOT.getName();
ServiceError serviceError = DeviceControllerException.errors.restoreFSFromSnapshotFailed(fs.toString(), opName, ex);
completer.error(s_dbClient, this._locker, serviceError);
}
}
use of com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeFSSnapshotTaskCompleter in project coprhd-controller by CoprHD.
the class VNXUnityFileStorageDevice method doRestoreFS.
@Override
public BiosCommandResult doRestoreFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
_logger.info("restoring file system {} snap {} ", args.getFsName(), args.getSnapshotLabel());
VNXeApiClient apiClient = getVnxUnityClient(storage);
VNXeCommandJob job = null;
VNXeFSSnapshotTaskCompleter completer = null;
try {
job = apiClient.restoreFileSystemSnap(args.getSnapNativeId());
if (job != null) {
completer = new VNXeFSSnapshotTaskCompleter(Snapshot.class, args.getSnapshotId(), args.getOpId());
VNXeRestoreFileSystemSnapshotJob snapJob = new VNXeRestoreFileSystemSnapshotJob(job.getId(), storage.getId(), completer);
ControllerServiceImpl.enqueueJob(new QueueJob(snapJob));
} else {
_logger.error("No job returned from restoreFileSystemSnap");
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("restoreSnapshotFileSystem", "No Job returned from restoreFileSystemSnap");
return BiosCommandResult.createErrorResult(error);
}
} catch (VNXeException e) {
_logger.error("Restore file system snapshot got the exception", e);
if (completer != null) {
completer.error(dbClient, e);
}
return BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Restore file system snpashot got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("RestoreFileSystemSnapshot", ex.getMessage());
if (completer != null) {
completer.error(dbClient, error);
}
return BiosCommandResult.createErrorResult(error);
}
StringBuilder logMsgBuilder = new StringBuilder(String.format("Restore filesystem snapshot job submitted - Array:%s, fileSystem: %s, snapshot: %s", storage.getSerialNumber(), args.getFsName(), args.getSnapshotLabel()));
_logger.info(logMsgBuilder.toString());
return BiosCommandResult.createPendingResult();
}
use of com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeFSSnapshotTaskCompleter in project coprhd-controller by CoprHD.
the class VNXUnityFileStorageDevice method doSnapshotFS.
@Override
public BiosCommandResult doSnapshotFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
_logger.info("creating file system {} snap {} ", args.getFsName(), args.getSnapshotLabel());
VNXeApiClient apiClient = getVnxUnityClient(storage);
VNXeCommandJob job = null;
VNXeFSSnapshotTaskCompleter completer = null;
try {
job = apiClient.createFileSystemSnap(args.getFsNativeId(), args.getSnapshotName());
if (job != null) {
completer = new VNXeFSSnapshotTaskCompleter(Snapshot.class, args.getSnapshotId(), args.getOpId());
VNXeCreateFileSystemSnapshotJob snapJob = new VNXeCreateFileSystemSnapshotJob(job.getId(), storage.getId(), completer);
ControllerServiceImpl.enqueueJob(new QueueJob(snapJob));
} else {
_logger.error("No job returned from createFileSystemSnap");
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("snapshotFileSystem", "No Job returned from createFileSystemSnap");
return BiosCommandResult.createErrorResult(error);
}
} catch (VNXeException e) {
_logger.error("Create file system snapshot got an exception", e);
if (completer != null) {
completer.error(dbClient, e);
}
return BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Create file system snapshot got an exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("CreateFileSystemSnapshot", ex.getMessage());
if (completer != null) {
completer.error(dbClient, error);
}
return BiosCommandResult.createErrorResult(error);
}
StringBuilder logMsgBuilder = new StringBuilder(String.format("Create filesystem snapshot job submitted - Array:%s, fileSystem: %s", storage.getSerialNumber(), args.getFsName()));
_logger.info(logMsgBuilder.toString());
return BiosCommandResult.createPendingResult();
}
use of com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeFSSnapshotTaskCompleter in project coprhd-controller by CoprHD.
the class VNXeStorageDevice method doRestoreFS.
@Override
public BiosCommandResult doRestoreFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
_logger.info("restoring file system {} snap {} ", args.getFsName(), args.getSnapshotLabel());
VNXeApiClient apiClient = getVnxeClient(storage);
VNXeCommandJob job = null;
VNXeFSSnapshotTaskCompleter completer = null;
try {
job = apiClient.restoreFileSystemSnap(args.getSnapNativeId());
if (job != null) {
completer = new VNXeFSSnapshotTaskCompleter(Snapshot.class, args.getSnapshotId(), args.getOpId());
VNXeRestoreFileSystemSnapshotJob snapJob = new VNXeRestoreFileSystemSnapshotJob(job.getId(), storage.getId(), completer);
ControllerServiceImpl.enqueueJob(new QueueJob(snapJob));
} else {
_logger.error("No job returned from restoreFileSystemSnap");
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("restoreSnapshotFileSystem", "No Job returned from restoreFileSystemSnap");
return BiosCommandResult.createErrorResult(error);
}
} catch (VNXeException e) {
_logger.error("Restore file system snapshot got the exception", e);
if (completer != null) {
completer.error(_dbClient, e);
}
return BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Restore file system snpashot got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("RestoreFileSystemSnapshot", ex.getMessage());
if (completer != null) {
completer.error(_dbClient, error);
}
return BiosCommandResult.createErrorResult(error);
}
StringBuilder logMsgBuilder = new StringBuilder(String.format("Restore filesystem snapshot job submitted - Array:%s, fileSystem: %s, snapshot: %s", storage.getSerialNumber(), args.getFsName(), args.getSnapshotLabel()));
_logger.info(logMsgBuilder.toString());
return BiosCommandResult.createPendingResult();
}
use of com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeFSSnapshotTaskCompleter in project coprhd-controller by CoprHD.
the class VNXeStorageDevice method doSnapshotFS.
@Override
public BiosCommandResult doSnapshotFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
_logger.info("creating file system {} snap {} ", args.getFsName(), args.getSnapshotLabel());
VNXeApiClient apiClient = getVnxeClient(storage);
VNXeCommandJob job = null;
VNXeFSSnapshotTaskCompleter completer = null;
try {
job = apiClient.createFileSystemSnap(args.getFsNativeId(), args.getSnapshotName());
if (job != null) {
completer = new VNXeFSSnapshotTaskCompleter(Snapshot.class, args.getSnapshotId(), args.getOpId());
VNXeCreateFileSystemSnapshotJob snapJob = new VNXeCreateFileSystemSnapshotJob(job.getId(), storage.getId(), completer);
ControllerServiceImpl.enqueueJob(new QueueJob(snapJob));
} else {
_logger.error("No job returned from createFileSystemSnap");
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("snapshotFileSystem", "No Job returned from createFileSystemSnap");
return BiosCommandResult.createErrorResult(error);
}
} catch (VNXeException e) {
_logger.error("Create file system snapshot got the exception", e);
if (completer != null) {
completer.error(_dbClient, e);
}
return BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Create file system snpashot got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("CreateFileSystemSnapshot", ex.getMessage());
if (completer != null) {
completer.error(_dbClient, error);
}
return BiosCommandResult.createErrorResult(error);
}
StringBuilder logMsgBuilder = new StringBuilder(String.format("Create filesystem snapshot job submitted - Array:%s, fileSystem: %s", storage.getSerialNumber(), args.getFsName()));
_logger.info(logMsgBuilder.toString());
return BiosCommandResult.createPendingResult();
}
Aggregations