You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2012/11/02 18:34:49 UTC

[4/6] git commit: CS-16213: agent LB - don't process Disconnect event from other management server in cluster, if the recipient is the future owner of the host. The disconnect will be handled during the rebalance host connection process itself. Reviewed-

CS-16213: agent LB - don't process Disconnect event from other management server in cluster, if the recipient is the future owner of the host. The disconnect will be handled during the rebalance host connection process itself.
Reviewed-by: Kelven Yang


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/36babbfc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/36babbfc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/36babbfc

Branch: refs/heads/master
Commit: 36babbfcac0f2d3cab4c8b8eb3c1b2e9a58936ce
Parents: 705130e
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Thu Aug 30 17:43:10 2012 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Fri Nov 2 09:59:37 2012 -0700

----------------------------------------------------------------------
 .../agent/manager/ClusteredAgentManagerImpl.java   |   29 ++++++++++++++-
 1 files changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/36babbfc/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java b/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
index 65ff8f0..df763f3 100755
--- a/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
+++ b/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
@@ -305,6 +305,16 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
             }
             AgentAttache attache = findAttache(hostId);
             if (attache != null) {
+                if (_clusterMgr.isAgentRebalanceEnabled()) {
+                    //don't process disconnect if the host is being rebalanced
+                    HostTransferMapVO transferVO = _hostTransferDao.findById(hostId);
+                    if (transferVO != null) {
+                        if (transferVO.getFutureOwner() == _nodeId && transferVO.getState() == HostTransferState.TransferStarted) {
+                            s_logger.debug("Not processing disconnect event as the host is being connected to " + _nodeId);
+                            return true;
+                        }
+                    }
+                }
                 handleDisconnect(attache, Event.AgentDisconnected, false, false);
             }
 
@@ -936,9 +946,24 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
             HostVO host = _hostDao.findById(hostId);
             try {
                 if (s_logger.isDebugEnabled()) {
-                    s_logger.debug("Loading directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + " as a part of rebalance process");
+                    s_logger.debug("Disconnecting host " + host.getId() + "(" + host.getName() + " as a part of rebalance process without notification");
                 }
-                result = loadDirectlyConnectedHost(host, true);
+
+                AgentAttache attache = findAttache(hostId);
+                if (attache != null) {
+                    result = handleDisconnect(attache, Event.AgentDisconnected, false, false);
+                }
+
+                if (result) {
+                    if (s_logger.isDebugEnabled()) {
+                        s_logger.debug("Loading directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + " as a part of rebalance process");
+                    }
+                    result = loadDirectlyConnectedHost(host, true);
+                } else {
+                    s_logger.warn("Failed to disconnect " + host.getId() + "(" + host.getName() + 
+                            " as a part of rebalance process without notification");
+                }
+                
             } catch (Exception ex) {
                 s_logger.warn("Failed to load directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + " as a part of rebalance process due to:", ex);
                 result = false;