Search in sources :

Example 16 with ComputeSystem

use of com.emc.storageos.db.client.model.ComputeSystem in project coprhd-controller by CoprHD.

the class ComputeDeviceControllerImpl method setNoBoot.

private void setNoBoot(URI computeSystemId, URI computeElementId, URI hostId, boolean waitForServerRestart) throws InternalException {
    log.info("Compute Element %s is being set to No Boot", computeElementId);
    ComputeSystem cs = _dbClient.queryObject(ComputeSystem.class, computeSystemId);
    getDevice(cs.getSystemType()).setNoBoot(cs, computeElementId, hostId, waitForServerRestart);
}
Also used : ComputeSystem(com.emc.storageos.db.client.model.ComputeSystem)

Example 17 with ComputeSystem

use of com.emc.storageos.db.client.model.ComputeSystem 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 18 with ComputeSystem

use of com.emc.storageos.db.client.model.ComputeSystem in project coprhd-controller by CoprHD.

the class ComputeDeviceControllerImpl method powerUpComputeElement.

private void powerUpComputeElement(URI computeSystemId, URI computeElementId) throws InternalException {
    log.info("powerUpComputeElement");
    ComputeSystem cs = _dbClient.queryObject(ComputeSystem.class, computeSystemId);
    getDevice(cs.getSystemType()).powerUpComputeElement(computeSystemId, computeElementId);
}
Also used : ComputeSystem(com.emc.storageos.db.client.model.ComputeSystem)

Example 19 with ComputeSystem

use of com.emc.storageos.db.client.model.ComputeSystem in project coprhd-controller by CoprHD.

the class ComputeDeviceControllerImpl method addStepsVcenterHostCleanup.

/**
 * Method to add steps to perform host cleanup operations on the vcenter
 *
 * @param workflow
 *            {@link Workflow} instance
 * @param waitFor
 *            {@link String} If non-null, the step will not be queued for
 *            execution in the Dispatcher until the Step or StepGroup
 *            indicated by the waitFor has completed. The waitFor may either
 *            be a string representation of a Step UUID, or the name of a
 *            StepGroup.
 * @param hostId
 *            {@link URI} hostId URI
 * @return waitFor step name
 */
@Override
public String addStepsVcenterHostCleanup(Workflow workflow, String waitFor, URI hostId) throws InternalException {
    Host host = _dbClient.queryObject(Host.class, hostId);
    if (NullColumnValueGetter.isNullURI(host.getComputeElement())) {
        /**
         * No steps need to be added - as this was not a host that we
         * created in ViPR. If it was computeElement property of the host
         * would have been set.
         */
        log.info("Skipping VCenter Host cleanup for host with no blade association.  Host is " + hostId);
        return waitFor;
    }
    ComputeElement computeElement = _dbClient.queryObject(ComputeElement.class, host.getComputeElement());
    if (computeElement != null) {
        ComputeSystem cs = _dbClient.queryObject(ComputeSystem.class, computeElement.getComputeSystem());
        waitFor = workflow.createStep(CHECK_HOST_INITIATORS, "Check for host initiators", waitFor, cs.getId(), cs.getSystemType(), this.getClass(), new Workflow.Method("checkHostInitiators", hostId), null, null);
        // any update to the host using the hostService automatically adds this association.
        if (!NullColumnValueGetter.isNullURI(host.getVcenterDataCenter()) && host.getType() != null && host.getType().equalsIgnoreCase((Host.HostType.No_OS).name())) {
            log.info("Skipping Vcenter host cleanup steps because No_OS is specified on host " + hostId);
        } else {
            waitFor = workflow.createStep(DEACTIVATION_MAINTENANCE_MODE, "If synced with vCenter, put the host in maintenance mode", waitFor, cs.getId(), cs.getSystemType(), this.getClass(), new Workflow.Method("putHostInMaintenanceMode", hostId), null, null);
            waitFor = workflow.createStep(DEACTIVATION_REMOVE_HOST_VCENTER, "If synced with vCenter, remove the host from the cluster", waitFor, cs.getId(), cs.getSystemType(), this.getClass(), new Workflow.Method("removeHostFromVcenterCluster", hostId), null, null);
        }
    }
    return waitFor;
}
Also used : ComputeElement(com.emc.storageos.db.client.model.ComputeElement) Host(com.emc.storageos.db.client.model.Host) ComputeSystem(com.emc.storageos.db.client.model.ComputeSystem)

Example 20 with ComputeSystem

use of com.emc.storageos.db.client.model.ComputeSystem in project coprhd-controller by CoprHD.

the class UcsComputeDevice method prepareOsInstallNetwork.

@Override
public Map<String, Boolean> prepareOsInstallNetwork(URI computeSystemId, URI computeElementId) throws InternalException {
    LOGGER.info("prepareOsInstallNetwork");
    ComputeSystem cs = _dbClient.queryObject(ComputeSystem.class, computeSystemId);
    ComputeElement ce = _dbClient.queryObject(ComputeElement.class, computeElementId);
    String osInstallVlan = cs.getOsInstallNetwork();
    Map<String, Boolean> vlanMap = null;
    try {
        vlanMap = ucsmService.setOsInstallVlan(getUcsmURL(cs).toString(), cs.getUsername(), cs.getPassword(), ce.getDn(), osInstallVlan);
    } catch (ClientGeneralException e) {
        LOGGER.error("Unable to set os install vlan: " + cs.getOsInstallNetwork() + " On computeElement : " + ce.getId(), e);
        throw ComputeSystemControllerException.exceptions.unableToSetOsInstallNetwork(osInstallVlan, ce.getId().toString(), e);
    }
    return vlanMap;
}
Also used : ComputeElement(com.emc.storageos.db.client.model.ComputeElement) ComputeSystem(com.emc.storageos.db.client.model.ComputeSystem) ClientGeneralException(com.emc.cloud.platform.clientlib.ClientGeneralException)

Aggregations

ComputeSystem (com.emc.storageos.db.client.model.ComputeSystem)50 ComputeElement (com.emc.storageos.db.client.model.ComputeElement)15 URI (java.net.URI)15 Host (com.emc.storageos.db.client.model.Host)14 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)13 Produces (javax.ws.rs.Produces)13 ComputeSystemControllerException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)12 Path (javax.ws.rs.Path)11 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)10 ImageServerControllerException (com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException)8 ComputeLanBootImagePath (com.emc.storageos.db.client.model.ComputeLanBootImagePath)7 ComputeSanBootImagePath (com.emc.storageos.db.client.model.ComputeSanBootImagePath)7 VcenterControllerException (com.emc.storageos.vcentercontroller.exceptions.VcenterControllerException)7 VcenterObjectConnectionException (com.emc.storageos.vcentercontroller.exceptions.VcenterObjectConnectionException)7 VcenterObjectNotFoundException (com.emc.storageos.vcentercontroller.exceptions.VcenterObjectNotFoundException)7 ClientGeneralException (com.emc.cloud.platform.clientlib.ClientGeneralException)6 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)6 MalformedURLException (java.net.MalformedURLException)6 POST (javax.ws.rs.POST)6 URL (java.net.URL)5