Search in sources :

Example 1 with CheckHealthAnswer

use of com.cloud.legacymodel.communication.answer.CheckHealthAnswer in project cosmic by MissionCriticalCloud.

the class NiciraCheckHealthCommandWrapper method execute.

@Override
public Answer execute(final CheckHealthCommand command, final NiciraNvpResource serverResource) {
    final NiciraNvpApi niciraNvpApi = serverResource.getNiciraNvpApi();
    boolean healthy = true;
    try {
        final ControlClusterStatus clusterStatus = niciraNvpApi.getControlClusterStatus();
        final String status = clusterStatus.getClusterStatus();
        if (clusterIsUnstable(status)) {
            s_logger.warn("Control cluster is not stable. Current status is " + status);
            healthy = false;
        }
    } catch (final NiciraNvpApiException e) {
        s_logger.error("Exception caught while checking control cluster status during health check", e);
        healthy = false;
    }
    return new CheckHealthAnswer(command, healthy);
}
Also used : ControlClusterStatus(com.cloud.network.nicira.ControlClusterStatus) CheckHealthAnswer(com.cloud.legacymodel.communication.answer.CheckHealthAnswer) NiciraNvpApi(com.cloud.network.nicira.NiciraNvpApi) NiciraNvpApiException(com.cloud.network.nicira.NiciraNvpApiException)

Aggregations

CheckHealthAnswer (com.cloud.legacymodel.communication.answer.CheckHealthAnswer)1 ControlClusterStatus (com.cloud.network.nicira.ControlClusterStatus)1 NiciraNvpApi (com.cloud.network.nicira.NiciraNvpApi)1 NiciraNvpApiException (com.cloud.network.nicira.NiciraNvpApiException)1