set timeout for CheckOnHostCommand to 50 s

This commit is contained in:
anthony 2011-09-02 11:06:34 -07:00
parent c7fb330914
commit c683fda236
2 changed files with 7 additions and 15 deletions

View File

@ -856,21 +856,13 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
s_logger.debug("checking if agent (" + hostId + ") is alive");
}
try {
Request req = new Request(hostId, _nodeId, new CheckHealthCommand(), true);
req.setSequence(agent.getNextSequence());
Answer[] answers = agent.send(req, 50 * 1000);
if (answers != null && answers[0] != null && answers[0].getResult()) {
Status status = Status.Up;
if (s_logger.isDebugEnabled()) {
s_logger.debug("agent (" + hostId + ") responded to checkHeathCommand, reporting that agent is " + status);
}
return status;
Answer answer = easySend(hostId, new CheckHealthCommand(), 50 * 1000);
if (answer != null && answer.getResult()) {
Status status = Status.Up;
if (s_logger.isDebugEnabled()) {
s_logger.debug("agent (" + hostId + ") responded to checkHeathCommand, reporting that agent is " + status);
}
} catch (AgentUnavailableException e) {
s_logger.debug("Agent is unavailable so we move on. Error: " + e.getMessage());
} catch (OperationTimedoutException e) {
s_logger.debug("Timed Out " + e.getMessage());
return status;
}
return _haMgr.investigate(hostId);

View File

@ -56,7 +56,7 @@ public class XenServerInvestigator extends AdapterBase implements Investigator {
if (neighbor.getId() == agent.getId() || neighbor.getHypervisorType() != HypervisorType.XenServer) {
continue;
}
Answer answer = _agentMgr.easySend(neighbor.getId(), cmd);
Answer answer = _agentMgr.easySend(neighbor.getId(), cmd, 50 * 1000);
if (answer != null && answer.getResult()) {
CheckOnHostAnswer ans = (CheckOnHostAnswer)answer;
if (!ans.isDetermined()) {