use of com.emc.storageos.volumecontroller.impl.file.MirrorFileStartTaskCompleter in project coprhd-controller by CoprHD.
the class FileDeviceController method performFileReplicationOperation.
@Override
public void performFileReplicationOperation(URI storage, URI sourceFSURI, String opType, String opId) throws ControllerException {
StorageSystem system = _dbClient.queryObject(StorageSystem.class, storage);
FileShare fileShare = _dbClient.queryObject(FileShare.class, sourceFSURI);
TaskCompleter completer = null;
BiosCommandResult result = new BiosCommandResult();
WorkflowStepCompleter.stepExecuting(opId);
_log.info("file replication operation {} started for file systerm {}", opType, fileShare.getName());
try {
if ("pause".equalsIgnoreCase(opType)) {
completer = new MirrorFilePauseTaskCompleter(FileShare.class, sourceFSURI, opId);
result = getDevice(system.getSystemType()).doPauseLink(system, fileShare);
} else if ("resume".equalsIgnoreCase(opType)) {
completer = new MirrorFileResumeTaskCompleter(FileShare.class, sourceFSURI, opId);
result = getDevice(system.getSystemType()).doResumeLink(system, fileShare, completer);
} else if ("start".equalsIgnoreCase(opType)) {
completer = new MirrorFileStartTaskCompleter(FileShare.class, sourceFSURI, opId);
result = getDevice(system.getSystemType()).doStartMirrorLink(system, fileShare, completer);
} else if ("refresh".equalsIgnoreCase(opType)) {
completer = new MirrorFileRefreshTaskCompleter(FileShare.class, sourceFSURI, opId);
result = getDevice(system.getSystemType()).doRefreshMirrorLink(system, fileShare);
} else if ("resync".equalsIgnoreCase(opType)) {
completer = new MirrorFileResyncTaskCompleter(FileShare.class, sourceFSURI, opId);
result = getDevice(system.getSystemType()).doResyncLink(system, fileShare, completer);
}
if (result.getCommandSuccess()) {
_log.info("file replication operation {} finished successfully for file systerm {}", opType, fileShare.getName());
completer.ready(_dbClient);
} else if (result.getCommandPending()) {
completer.statusPending(_dbClient, result.getMessage());
} else {
completer.error(_dbClient, result.getServiceCoded());
}
} catch (Exception e) {
_log.error("unable to perform mirror operation {} on file system {} ", opType, sourceFSURI, e);
updateTaskStatus(opId, fileShare, e);
ServiceError error = DeviceControllerException.errors.jobFailed(e);
WorkflowStepCompleter.stepFailed(opId, error);
}
}
Aggregations