use of com.cloud.hypervisor.ovm3.objects.Common 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.hypervisor.ovm3.objects.Common in project cloudstack by apache.
the class Ovm3HypervisorResource method getCurrentStatus.
@Override
public PingCommand getCurrentStatus(long id) {
try {
/* feels useless somehow */
Common test = new Common(c);
String ping = "put";
String pong = test.echo(ping);
if (pong.contains(ping)) {
hypervisorsupport.syncState();
CloudstackPlugin cSp = new CloudstackPlugin(c);
if (!cSp.dom0CheckStorageHealthCheck(configuration.getAgentScriptsDir(), configuration.getAgentCheckStorageScript(), configuration.getCsHostGuid(), configuration.getAgentStorageCheckTimeout(), configuration.getAgentStorageCheckInterval()) && !cSp.dom0CheckStorageHealthCheck()) {
LOGGER.error("Storage health check not running on " + configuration.getAgentHostname());
} else if (cSp.dom0CheckStorageHealthCheck()) {
LOGGER.error("Storage health check started on " + configuration.getAgentHostname());
} else {
LOGGER.debug("Storage health check running on " + configuration.getAgentHostname());
}
return new PingRoutingCommand(getType(), id, hypervisorsupport.hostVmStateReport());
} else {
LOGGER.debug("Agent did not respond correctly: " + ping + " but got " + pong);
}
} catch (Ovm3ResourceException | NullPointerException e) {
LOGGER.debug("Check agent status failed", e);
return null;
}
return null;
}
Aggregations