agent: don't investigate if host is null, send alert instead

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2015-02-05 16:42:13 +05:30
parent 419508b016
commit fb1069ace9
1 changed files with 13 additions and 11 deletions

View File

@ -438,20 +438,22 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
protected Status investigate(AgentAttache agent) {
Long hostId = agent.getId();
if (s_logger.isDebugEnabled()) {
s_logger.debug("checking if agent (" + hostId + ") is alive");
}
Answer answer = easySend(hostId, new CheckHealthCommand());
if (answer != null && answer.getResult()) {
Status status = Status.Up;
HostVO host = _hostDao.findById(hostId);
if (host != null && host.getType() != null && !host.getType().isVirtual()) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("agent (" + hostId + ") responded to checkHeathCommand, reporting that agent is " + status);
s_logger.debug("checking if agent (" + hostId + ") is alive");
}
return status;
Answer answer = easySend(hostId, new CheckHealthCommand());
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);
}
return status;
}
return _haMgr.investigate(hostId);
}
return _haMgr.investigate(hostId);
return Status.Alert;
}
protected AgentAttache getAttache(final Long hostId) throws AgentUnavailableException {