Search in sources :

Example 1 with ComputeSystemControllerTimeoutException

use of com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerTimeoutException in project coprhd-controller by CoprHD.

the class UcsComputeDevice method changePowerState.

private void changePowerState(URI csId, URI ceId, String state) throws DeviceControllerException {
    LOGGER.info("changePowerState");
    ComputeElement ce = _dbClient.queryObject(ComputeElement.class, ceId);
    ComputeSystem cs = _dbClient.queryObject(ComputeSystem.class, csId);
    OperationTypeEnum typeEnum = POWER_DOWN.equals(state) ? OperationTypeEnum.POWERDOWN_COMPUTE_ELEMENT : OperationTypeEnum.POWERUP_COMPUTE_ELEMENT;
    try {
        URL ucsmURL = getUcsmURL(cs);
        StringBuilder errorMessage = new StringBuilder();
        ucsmService.setLsServerPowerState(ucsmURL.toString(), cs.getUsername(), cs.getPassword(), ce.getDn(), state, errorMessage);
        pullAndPollManagedObject(ucsmURL.toString(), cs.getUsername(), cs.getPassword(), ce.getLabel(), ComputeBlade.class);
    } catch (ComputeSystemControllerTimeoutException cstoe) {
        LOGGER.error("Unable to change power state of compute element due to a device TimeOut", cstoe);
        throw cstoe;
    } catch (Exception e) {
        LOGGER.error("Unable to change power state of compute element due to a exception", e);
        throw ComputeSystemControllerException.exceptions.powerStateChangeFailed(state, ce != null ? ce.getId().toString() : null, e);
    }
    _auditMgr.recordAuditLog(null, null, EVENT_SERVICE_TYPE_CE, typeEnum, System.currentTimeMillis(), AuditLogManager.AUDITLOG_SUCCESS, AuditLogManager.AUDITOP_END, ce.getId().toString(), ce.getLabel(), ce.getNativeGuid(), ce.getUuid(), ce.getOriginalUuid());
}
Also used : ComputeSystemControllerTimeoutException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerTimeoutException) OperationTypeEnum(com.emc.storageos.services.OperationTypeEnum) ComputeElement(com.emc.storageos.db.client.model.ComputeElement) ComputeSystem(com.emc.storageos.db.client.model.ComputeSystem) URL(java.net.URL) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ComputeSystemControllerTimeoutException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerTimeoutException) MalformedURLException(java.net.MalformedURLException) ClientGeneralException(com.emc.cloud.platform.clientlib.ClientGeneralException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)

Aggregations

ClientGeneralException (com.emc.cloud.platform.clientlib.ClientGeneralException)1 ComputeSystemControllerException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)1 ComputeSystemControllerTimeoutException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerTimeoutException)1 ComputeElement (com.emc.storageos.db.client.model.ComputeElement)1 ComputeSystem (com.emc.storageos.db.client.model.ComputeSystem)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 OperationTypeEnum (com.emc.storageos.services.OperationTypeEnum)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1