Skip to content

Commit aa00ef9

Browse files
authored
Prevent vm's from stopping while enabling maintenance mode (apache#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
1 parent 5845de4 commit aa00ef9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,8 +875,10 @@ protected boolean handleDisconnectWithInvestigation(final AgentAttache attache,
875875
agentStatusTransitTo(host, Status.Event.Ping, _nodeId);
876876
return false;
877877
} else if (determinedState == Status.Disconnected) {
878-
s_logger.warn("Agent is disconnected but the host is still up: " + host.getId() + "-" + host.getName());
879-
if (currentStatus == Status.Disconnected) {
878+
s_logger.warn("Agent is disconnected but the host is still up: " + host.getId() + "-" + host.getName() +
879+
'-' + host.getResourceState());
880+
if (currentStatus == Status.Disconnected ||
881+
(currentStatus == Status.Up && host.getResourceState() == ResourceState.PrepareForMaintenance)) {
880882
if ((System.currentTimeMillis() >> 10) - host.getLastPinged() > AlertWait.value()) {
881883
s_logger.warn("Host " + host.getId() + " has been disconnected past the wait time it should be disconnected.");
882884
event = Status.Event.WaitedTooLong;

0 commit comments

Comments
 (0)