use of com.cloud.agent.api.CheckHealthAnswer in project cloudstack by apache.
the class Ovm3HypervisorSupport method execute.
/**
* CheckHealthAnwer: Check the health of an agent on the hypervisor.
* TODO: should elaborate here with checks...
*
* @param cmd
* @return
*/
public CheckHealthAnswer execute(CheckHealthCommand cmd) {
Common test = new Common(c);
String ping = "put";
String pong;
try {
pong = test.echo(ping);
} catch (Ovm3ResourceException e) {
LOGGER.debug("CheckHealth went wrong: " + config.getAgentHostname() + ", " + e.getMessage(), e);
return new CheckHealthAnswer(cmd, false);
}
if (ping.contentEquals(pong)) {
return new CheckHealthAnswer(cmd, true);
}
LOGGER.debug("CheckHealth did not receive " + ping + " but got " + pong + " from " + config.getAgentHostname());
return new CheckHealthAnswer(cmd, false);
}
use of com.cloud.agent.api.CheckHealthAnswer in project cloudstack by apache.
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);
}
Aggregations