Skip to content

Commit 1904a70

Browse files
authored
agent: on shutdown don't allow server reconnection (#2904)
When agent is stopped, don't allow reconnection. Previously this would send a shutdown command to the management server which would put the host state to Disconnected but then agent's reconnection logic may kick in sometimes which would connect the agent to the management server but then the agent process would terminate causing the host to be put in Alert state (due to ping timeout or it waiting too long). This fixes the issue by ensuring that when the agent is stopped, it does not reconnect to the management server. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 9003c7b commit 1904a70

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

agent/src/com/cloud/agent/Agent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ public void start() {
303303

304304
public void stop(final String reason, final String detail) {
305305
s_logger.info("Stopping the agent: Reason = " + reason + (detail != null ? ": Detail = " + detail : ""));
306+
_reconnectAllowed = false;
306307
if (_connection != null) {
307308
final ShutdownCommand cmd = new ShutdownCommand(reason, detail);
308309
try {

0 commit comments

Comments
 (0)