Search in sources :

Example 1 with ImageServerControllerException

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);
    }
}
Also used : ServiceCoded(com.emc.storageos.svcs.errorhandling.model.ServiceCoded) ImageServerControllerException(com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException) ComputeSystem(com.emc.storageos.db.client.model.ComputeSystem) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) VcenterControllerException(com.emc.storageos.vcentercontroller.exceptions.VcenterControllerException) VcenterObjectConnectionException(com.emc.storageos.vcentercontroller.exceptions.VcenterObjectConnectionException) VcenterObjectNotFoundException(com.emc.storageos.vcentercontroller.exceptions.VcenterObjectNotFoundException) ImageServerControllerException(com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException)

Example 2 with ImageServerControllerException

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);
    }
}
Also used : ImageServerControllerException(com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException) ComputeSystem(com.emc.storageos.db.client.model.ComputeSystem) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) VcenterControllerException(com.emc.storageos.vcentercontroller.exceptions.VcenterControllerException) VcenterObjectConnectionException(com.emc.storageos.vcentercontroller.exceptions.VcenterObjectConnectionException) VcenterObjectNotFoundException(com.emc.storageos.vcentercontroller.exceptions.VcenterObjectNotFoundException) ImageServerControllerException(com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)

Example 3 with ImageServerControllerException

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);
    }
}
Also used : ServiceCoded(com.emc.storageos.svcs.errorhandling.model.ServiceCoded) ImageServerControllerException(com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException) ComputeSystem(com.emc.storageos.db.client.model.ComputeSystem) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) VcenterControllerException(com.emc.storageos.vcentercontroller.exceptions.VcenterControllerException) VcenterObjectConnectionException(com.emc.storageos.vcentercontroller.exceptions.VcenterObjectConnectionException) VcenterObjectNotFoundException(com.emc.storageos.vcentercontroller.exceptions.VcenterObjectNotFoundException) ImageServerControllerException(com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException)

Example 4 with ImageServerControllerException

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);
    }
}
Also used : ImageServerControllerException(com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException) ComputeElement(com.emc.storageos.db.client.model.ComputeElement) Map(java.util.Map) OpStatusMap(com.emc.storageos.db.client.model.OpStatusMap) HashMap(java.util.HashMap) ComputeSystem(com.emc.storageos.db.client.model.ComputeSystem) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) VcenterControllerException(com.emc.storageos.vcentercontroller.exceptions.VcenterControllerException) VcenterObjectConnectionException(com.emc.storageos.vcentercontroller.exceptions.VcenterObjectConnectionException) VcenterObjectNotFoundException(com.emc.storageos.vcentercontroller.exceptions.VcenterObjectNotFoundException) ImageServerControllerException(com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)

Example 5 with ImageServerControllerException

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);
    }
}
Also used : ServiceCoded(com.emc.storageos.svcs.errorhandling.model.ServiceCoded) ImageServerControllerException(com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException) ComputeSystem(com.emc.storageos.db.client.model.ComputeSystem) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) VcenterControllerException(com.emc.storageos.vcentercontroller.exceptions.VcenterControllerException) VcenterObjectConnectionException(com.emc.storageos.vcentercontroller.exceptions.VcenterObjectConnectionException) VcenterObjectNotFoundException(com.emc.storageos.vcentercontroller.exceptions.VcenterObjectNotFoundException) ImageServerControllerException(com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException)

Aggregations

ComputeSystemControllerException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)5 ComputeSystem (com.emc.storageos.db.client.model.ComputeSystem)5 ImageServerControllerException (com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException)5 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)5 VcenterControllerException (com.emc.storageos.vcentercontroller.exceptions.VcenterControllerException)5 VcenterObjectConnectionException (com.emc.storageos.vcentercontroller.exceptions.VcenterObjectConnectionException)5 VcenterObjectNotFoundException (com.emc.storageos.vcentercontroller.exceptions.VcenterObjectNotFoundException)5 ServiceCoded (com.emc.storageos.svcs.errorhandling.model.ServiceCoded)3 ComputeElement (com.emc.storageos.db.client.model.ComputeElement)1 OpStatusMap (com.emc.storageos.db.client.model.OpStatusMap)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1