Skip to content

Commit fb1069a

Browse files
committed
agent: don't investigate if host is null, send alert instead
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 419508b commit fb1069a

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

‎engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -438,20 +438,22 @@ public Answer[] send(Long hostId, Commands commands, int timeout) throws AgentUn
438438

439439
protected Status investigate(AgentAttache agent) {
440440
Long hostId = agent.getId();
441-
if (s_logger.isDebugEnabled()) {
442-
s_logger.debug("checking if agent (" + hostId + ") is alive");
443-
}
444-
445-
Answer answer = easySend(hostId, new CheckHealthCommand());
446-
if (answer != null && answer.getResult()) {
447-
Status status = Status.Up;
441+
HostVO host = _hostDao.findById(hostId);
442+
if (host != null && host.getType() != null && !host.getType().isVirtual()) {
448443
if (s_logger.isDebugEnabled()) {
449-
s_logger.debug("agent (" + hostId + ") responded to checkHeathCommand, reporting that agent is " + status);
444+
s_logger.debug("checking if agent (" + hostId + ") is alive");
450445
}
451-
return status;
446+
Answer answer = easySend(hostId, new CheckHealthCommand());
447+
if (answer != null && answer.getResult()) {
448+
Status status = Status.Up;
449+
if (s_logger.isDebugEnabled()) {
450+
s_logger.debug("agent (" + hostId + ") responded to checkHeathCommand, reporting that agent is " + status);
451+
}
452+
return status;
453+
}
454+
return _haMgr.investigate(hostId);
452455
}
453-
454-
return _haMgr.investigate(hostId);
456+
return Status.Alert;
455457
}
456458

457459
protected AgentAttache getAttache(final Long hostId) throws AgentUnavailableException {

0 commit comments

Comments
 (0)