use of com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException in project coprhd-controller by CoprHD.
the class ComputeDeviceControllerImpl method unbindHostFromTemplateStep.
/**
* Unbind host from service profile template
*
* @param computeSystemId
* {@link URI} computeSystem URI
* @param hostId
* {@link URI} host URI
* @param stepId
* {@link String} step id
*/
public void unbindHostFromTemplateStep(URI computeSystemId, URI hostId, String stepId) {
log.info("unbindHostFromTemplateStep");
ComputeSystem computeSystem = null;
try {
WorkflowStepCompleter.stepExecuting(stepId);
computeSystem = _dbClient.queryObject(ComputeSystem.class, computeSystemId);
String sptDn = unbindHostFromTemplate(computeSystemId, hostId);
_workflowService.storeStepData(stepId, sptDn);
WorkflowStepCompleter.stepSucceded(stepId);
} catch (InternalException e) {
String opName = ResourceOperationTypeEnum.INSTALL_OPERATING_SYSTEM.getName();
ServiceCoded sce = ImageServerControllerException.exceptions.unexpectedException(opName, e);
if (computeSystem != null) {
sce = ComputeSystemControllerException.exceptions.unableToUpdateHostAfterOSInstall(hostId.toString(), e);
}
log.error("Exception unbindHostFromTemplateStep: " + e.getMessage(), e);
WorkflowStepCompleter.stepFailed(stepId, sce);
} catch (Exception e) {
String opName = ResourceOperationTypeEnum.INSTALL_OPERATING_SYSTEM.getName();
ImageServerControllerException controllerException = ImageServerControllerException.exceptions.unexpectedException(opName, e);
log.error("Unexpected exception unbindHostFromTemplateStep: " + e.getMessage(), e);
WorkflowStepCompleter.stepFailed(stepId, controllerException);
}
}
use of com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException in project coprhd-controller by CoprHD.
the class ComputeDeviceControllerImpl method rollbackUnbindHostFromTemplate.
/**
* Roll back method to undo changes of a unbindhost from template step
*
* @param computeSystemId
* {@link URI} computeSystem URI
* @param hostId
* {@link URI} host URI
* @param stepId
* {@link String} step id
*/
public void rollbackUnbindHostFromTemplate(URI computeSystemId, URI hostId, String stepId) {
log.info("rollbackUnbindHostFromTemplate");
try {
WorkflowStepCompleter.stepExecuting(stepId);
ComputeSystem cs = _dbClient.queryObject(ComputeSystem.class, computeSystemId);
rebindHostToTemplate(cs.getId(), hostId);
// TODO COP-28961 check if rebind succeeded, and if not, mark rollback as failed
WorkflowStepCompleter.stepSucceded(stepId);
} catch (Exception e) {
String opName = ResourceOperationTypeEnum.INSTALL_OPERATING_SYSTEM.getName();
ImageServerControllerException controllerException = ImageServerControllerException.exceptions.unexpectedException(opName, e);
log.error("Unexpected exception rollbackUnbindHostFromTemplate: " + e.getMessage(), e);
WorkflowStepCompleter.stepFailed(stepId, controllerException);
}
}
use of com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException in project coprhd-controller by CoprHD.
the class ComputeDeviceControllerImpl method rebindHostToTemplateStep.
/**
* Bind host to a service profile template step
*
* @param computeSystemId
* {@link URI} computeSystem URI
* @param hostId
* {@link URI} host URI
* @param stepId
* {@link String} step id
*/
public void rebindHostToTemplateStep(URI computeSystemId, URI hostId, String stepId) {
log.info("rebindHostToTemplateStep");
ComputeSystem computeSystem = null;
try {
WorkflowStepCompleter.stepExecuting(stepId);
computeSystem = _dbClient.queryObject(ComputeSystem.class, hostId);
rebindHostToTemplate(computeSystemId, hostId);
// TODO COP-28961 process the return value, and mark step as failed in case of error
WorkflowStepCompleter.stepSucceded(stepId);
} catch (InternalException e) {
String opName = ResourceOperationTypeEnum.INSTALL_OPERATING_SYSTEM.getName();
ServiceCoded sce = ImageServerControllerException.exceptions.unexpectedException(opName, e);
if (computeSystem != null) {
sce = ComputeSystemControllerException.exceptions.unableToUpdateHostAfterOSInstall(hostId.toString(), e);
}
log.error("Exception rebindHostToTemplateStep: " + e.getMessage(), e);
WorkflowStepCompleter.stepFailed(stepId, sce);
} catch (Exception e) {
String opName = ResourceOperationTypeEnum.INSTALL_OPERATING_SYSTEM.getName();
ImageServerControllerException controllerException = ImageServerControllerException.exceptions.unexpectedException(opName, e);
log.error("Unexpected exception rebindHostToTemplateStep: " + e.getMessage(), e);
WorkflowStepCompleter.stepFailed(stepId, controllerException);
}
}
use of com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException in project coprhd-controller by CoprHD.
the class ComputeDeviceControllerImpl method rollbackOsInstallNetwork.
/**
* Roll back method to undo changes of a prepareOsInstallNetworkStep
*
* @param computeSystemId
* {@link URI} compute system URI
* @param computeElementId
* {@link URI} compute element URI
* @param prepareStepId
* parent workflow step id
* @param stepId
* current step id
*/
public void rollbackOsInstallNetwork(URI computeSystemId, URI computeElementId, String prepareStepId, String stepId) {
log.info("rollbackOsInstallNetwork");
try {
WorkflowStepCompleter.stepExecuting(stepId);
ComputeElement ce = _dbClient.queryObject(ComputeElement.class, computeElementId);
ComputeSystem cs = _dbClient.queryObject(ComputeSystem.class, computeSystemId);
@SuppressWarnings("unchecked") Map<String, Boolean> vlanMap = (Map<String, Boolean>) _workflowService.loadStepData(prepareStepId);
log.info("vlanMap {}", vlanMap);
if (vlanMap != null) {
removeOsInstallNetwork(cs.getId(), cs.getSystemType(), ce.getId(), vlanMap);
}
WorkflowStepCompleter.stepSucceded(stepId);
} catch (Exception e) {
String opName = ResourceOperationTypeEnum.INSTALL_OPERATING_SYSTEM.getName();
ImageServerControllerException controllerException = ImageServerControllerException.exceptions.unexpectedException(opName, e);
log.error("Unexpected exception rollbackOsInstallNetwork: " + e.getMessage(), e);
WorkflowStepCompleter.stepFailed(stepId, controllerException);
}
}
use of com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException in project coprhd-controller by CoprHD.
the class ComputeDeviceControllerImpl method prepareOsInstallNetworkStep.
/**
* Method or step responsible for setting up the required OS install network
*
* @param computeSystemId
* {@link URI} compute system URI
* @param computeElementId
* {@link URI} compute element URI
* @param stepId
* {@link String} step id
*/
public void prepareOsInstallNetworkStep(URI computeSystemId, URI computeElementId, String stepId) {
log.info("prepareOsInstallNetworkStep");
ComputeSystem computeSystem = null;
try {
WorkflowStepCompleter.stepExecuting(stepId);
computeSystem = _dbClient.queryObject(ComputeSystem.class, computeSystemId);
// Test mechanism to invoke a failure. No-op on production systems.
InvokeTestFailure.internalOnlyInvokeTestFailure(InvokeTestFailure.ARTIFICIAL_FAILURE_071);
Map<String, Boolean> vlanMap = prepareOsInstallNetwork(computeSystemId, computeElementId);
_workflowService.storeStepData(stepId, vlanMap);
WorkflowStepCompleter.stepSucceded(stepId);
} catch (InternalException e) {
String opName = ResourceOperationTypeEnum.INSTALL_OPERATING_SYSTEM.getName();
ServiceCoded sce = ImageServerControllerException.exceptions.unexpectedException(opName, e);
if (computeSystem != null) {
sce = ComputeSystemControllerException.exceptions.unableToSetOsInstallNetwork(computeSystem.getOsInstallNetwork(), computeElementId.toString(), e);
}
log.error("Exception prepareOsInstallNetworkStep: " + e.getMessage(), e);
WorkflowStepCompleter.stepFailed(stepId, sce);
} catch (Exception e) {
String opName = ResourceOperationTypeEnum.INSTALL_OPERATING_SYSTEM.getName();
ImageServerControllerException controllerException = ImageServerControllerException.exceptions.unexpectedException(opName, e);
log.error("Unexpected exception prepareOsInstallNetworkStep: " + e.getMessage(), e);
WorkflowStepCompleter.stepFailed(stepId, controllerException);
}
}
Aggregations