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());
}
Aggregations