Prevent vm's from stopping while enabling maintenance mode (#4636)

Sometimes when host isput into maintenance, the connection get
disconnected and as result vm's are stopped. So check for extra state
before considering host as down and stopping the vm's
This commit is contained in:
Rakesh 2022-03-25 15:46:45 +01:00 committed by GitHub
parent 5845de4004
commit aa00ef90c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -875,8 +875,10 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
agentStatusTransitTo(host, Status.Event.Ping, _nodeId);
return false;
} else if (determinedState == Status.Disconnected) {
s_logger.warn("Agent is disconnected but the host is still up: " + host.getId() + "-" + host.getName());
if (currentStatus == Status.Disconnected) {
s_logger.warn("Agent is disconnected but the host is still up: " + host.getId() + "-" + host.getName() +
'-' + host.getResourceState());
if (currentStatus == Status.Disconnected ||
(currentStatus == Status.Up && host.getResourceState() == ResourceState.PrepareForMaintenance)) {
if ((System.currentTimeMillis() >> 10) - host.getLastPinged() > AlertWait.value()) {
s_logger.warn("Host " + host.getId() + " has been disconnected past the wait time it should be disconnected.");
event = Status.Event.WaitedTooLong;