CS-16022: If host connection fails due to some DB error, host disconnect does not happen and mgmt_server_id is not removed.
Making sure host disconnect is called. Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/61a19eb0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/61a19eb0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/61a19eb0 Branch: refs/heads/master Commit: 61a19eb089d13fa5ad298f6f1ea47491d916328c Parents: f57f96f Author: Prachi Damle <[email protected]> Authored: Wed Aug 15 17:56:18 2012 -0700 Committer: Prachi Damle <[email protected]> Committed: Thu Sep 6 16:30:50 2012 -0700 ---------------------------------------------------------------------- .../com/cloud/resource/ResourceManagerImpl.java | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/61a19eb0/server/src/com/cloud/resource/ResourceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index 1414370..988f438 100755 --- a/server/src/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java @@ -1639,7 +1639,16 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma if (cmds != null) { resource.disconnected(); } - + if(host == null){ + if (cmds != null) { + StartupCommand firstCmd = cmds[0]; + host = findHostByGuid(firstCmd.getGuid()); + if (host == null) { + host = findHostByGuid(firstCmd.getGuidWithoutResource()); + } + } + } + if (host != null) { /* Change agent status to Alert */ _agentMgr.agentStatusTransitTo(host, Status.Event.AgentDisconnected, _nodeId);
