set timeout for CheckOnHostCommand to 50 s

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

View File

@ -854,21 +854,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()) {