use of com.cloud.legacymodel.communication.answer.CheckOnHostAnswer in project cosmic by MissionCriticalCloud.
the class XenServerInvestigator method isAgentAlive.
@Override
public HostStatus isAgentAlive(final Host agent) {
if (agent.getHypervisorType() != HypervisorType.XenServer) {
return null;
}
final CheckOnHostCommand cmd = new CheckOnHostCommand(agent);
final List<HostVO> neighbors = _resourceMgr.listAllHostsInCluster(agent.getClusterId());
for (final HostVO neighbor : neighbors) {
if (neighbor.getId() == agent.getId() || neighbor.getHypervisorType() != HypervisorType.XenServer) {
continue;
}
final Answer answer = _agentMgr.easySend(neighbor.getId(), cmd);
if (answer != null && answer.getResult()) {
final CheckOnHostAnswer ans = (CheckOnHostAnswer) answer;
if (!ans.isDetermined()) {
s_logger.debug("Host " + neighbor + " couldn't determine the status of " + agent);
continue;
}
// even it returns true, that means host is up, but XAPI may not work
return ans.isAlive() ? null : HostStatus.Down;
}
}
return null;
}
Aggregations