use of com.emc.storageos.volumecontroller.ControllerException in project coprhd-controller by CoprHD.
the class ComputeSystemControllerImpl method setHostBootVolume.
@Override
public void setHostBootVolume(URI host, URI bootVolumeId, boolean updateSanBootTargets, String taskId) throws ControllerException {
TaskCompleter completer = null;
try {
completer = new HostCompleter(host, false, taskId);
Workflow workflow = _workflowService.getNewWorkflow(this, SET_SAN_BOOT_TARGETS_WF_NAME, true, taskId);
String waitFor = addStepsForBootVolume(workflow, host, bootVolumeId);
if (updateSanBootTargets) {
waitFor = addStepsForSanBootTargets(workflow, host, bootVolumeId, waitFor);
}
workflow.executePlan(completer, "Success", null, null, null, null);
} catch (Exception ex) {
String message = "setHostSanBootTargets caught an exception.";
_log.error(message, ex);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(ex);
completer.error(_dbClient, serviceError);
}
}
use of com.emc.storageos.volumecontroller.ControllerException in project coprhd-controller by CoprHD.
the class ComputeSystemControllerImpl method addInitiatorsToExport.
@Override
public void addInitiatorsToExport(URI eventId, URI hostId, List<URI> initiators, String taskId) throws ControllerException {
TaskCompleter completer = null;
try {
completer = new InitiatorCompleter(eventId, initiators, InitiatorOperation.ADD, taskId);
Workflow workflow = _workflowService.getNewWorkflow(this, ADD_INITIATOR_STORAGE_WF_NAME, true, taskId);
String waitFor = null;
waitFor = addStepsForAddInitiators(workflow, waitFor, hostId, initiators, eventId);
workflow.executePlan(completer, "Success", null, null, null, null);
} catch (Exception ex) {
String message = "addInitiatorToStorage caught an exception.";
_log.error(message, ex);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(ex);
completer.error(_dbClient, serviceError);
}
}
use of com.emc.storageos.volumecontroller.ControllerException in project coprhd-controller by CoprHD.
the class ComputeSystemControllerImpl method setHostBootVolumeId.
public void setHostBootVolumeId(URI hostId, URI volumeId, String stepId) throws ControllerException {
_log.info("setHostBootVolumeId :" + hostId.toString());
Host host = null;
try {
WorkflowStepCompleter.stepExecuting(stepId);
host = _dbClient.queryObject(Host.class, hostId);
if (host == null) {
throw ComputeSystemControllerException.exceptions.hostNotFound(hostId.toString());
}
_log.info("Setting boot volume association for host");
host.setBootVolumeId(volumeId);
_dbClient.persistObject(host);
WorkflowStepCompleter.stepSucceded(stepId);
} catch (Exception e) {
_log.error("unexpected exception: " + e.getMessage(), e);
String hostString = hostId.toString();
if (host != null) {
hostString = host.getHostName();
}
ServiceCoded serviceCoded = ComputeSystemControllerException.exceptions.unableToSetBootVolume(hostString, e);
WorkflowStepCompleter.stepFailed(stepId, serviceCoded);
}
}
use of com.emc.storageos.volumecontroller.ControllerException 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.ControllerException in project coprhd-controller by CoprHD.
the class FileOrchestrationDeviceController method deleteSnapshot.
@Override
public void deleteSnapshot(URI storage, URI pool, URI uri, boolean forceDelete, String deleteType, String opId) throws ControllerException {
Snapshot snap = s_dbClient.queryObject(Snapshot.class, uri);
FileSnapshotWorkflowCompleter completer = new FileSnapshotWorkflowCompleter(uri, opId);
Workflow workflow = null;
try {
workflow = this._workflowService.getNewWorkflow(this, DELETE_FILESYSTEM_SNAPSHOT_WF_NAME, false, opId, completer);
String deleteSnapshotStep = workflow.createStepId();
String stepDescription = String.format("Deleting file System : %s snapshot: %s", snap.getParent(), uri);
Object[] args = new Object[] { storage, pool, uri, forceDelete, deleteType };
_fileDeviceController.createMethod(workflow, null, DELETE_FILESYSTEM_SNAPSHOT_METHOD, deleteSnapshotStep, stepDescription, storage, args);
String successMessage = String.format("Deleting file System : %s snapshot: %s finished successfully.", snap.getParent(), uri);
workflow.executePlan(completer, successMessage);
} catch (Exception ex) {
s_logger.error(String.format("Deleting file System : %s snapshot: %s failed.", snap.getParent(), uri), ex);
String opName = ResourceOperationTypeEnum.DELETE_FILE_SNAPSHOT.getName();
ServiceError serviceError = DeviceControllerException.errors.deleteFSSnapshotFailed(uri.toString(), opName, ex);
completer.error(s_dbClient, this._locker, serviceError);
}
}
Aggregations