mirror of https://github.com/apache/cloudstack.git
return a state instead of null
When a full cluster is down or unreachable, CloudStack currently reports everything the same as the last known state, which is usually Up. When it cannot reach a host and cannot reach another host in the same cluster either, it returns null and says "I don't know". This prevents it from reporting the problem. Now, we return an Alert or Disconnected state so proper action can be taken. Also logging was added, so we know what part of the code put it to Alert or Disconnected.
This commit is contained in:
parent
229f23874a
commit
78e095e64b
|
|
@ -92,7 +92,7 @@ public abstract class AbstractInvestigatorImpl extends AdapterBase implements In
|
|||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("host (" + testHostIp + ") returns null answer");
|
||||
}
|
||||
return null;
|
||||
return Status.Alert;
|
||||
}
|
||||
|
||||
if (pingTestAnswer.getResult()) {
|
||||
|
|
@ -103,14 +103,20 @@ public abstract class AbstractInvestigatorImpl extends AdapterBase implements In
|
|||
return Status.Up;
|
||||
} else {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("host (" + testHostIp + ") cannot be pinged, returning null ('I don't know')");
|
||||
s_logger.debug("host (" + testHostIp + ") cannot be pinged, returning Alert state");
|
||||
}
|
||||
return null;
|
||||
return Status.Alert;
|
||||
}
|
||||
} catch (AgentUnavailableException e) {
|
||||
return null;
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("host (" + testHostIp + "): " + e.getLocalizedMessage() + ", returning Disconnected state");
|
||||
}
|
||||
return Status.Disconnected;
|
||||
} catch (OperationTimedoutException e) {
|
||||
return null;
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("host (" + testHostIp + "): " + e.getLocalizedMessage() + ", returning Alert state");
|
||||
}
|
||||
return Status.Alert;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue