You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2013/02/15 02:57:12 UTC
git commit: refs/heads/4.1 - CLOUDSTACK-1137: force reconnect to a
disconnected host throws error.
Updated Branches:
refs/heads/4.1 06f13a269 -> 24b48f311
CLOUDSTACK-1137: force reconnect to a disconnected host throws error.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/24b48f31
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/24b48f31
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/24b48f31
Branch: refs/heads/4.1
Commit: 24b48f31190877bcb2f3803af4b06f858e0e904a
Parents: 06f13a2
Author: Min Chen <mi...@citrix.com>
Authored: Thu Feb 14 17:56:04 2013 -0800
Committer: Min Chen <mi...@citrix.com>
Committed: Thu Feb 14 17:56:45 2013 -0800
----------------------------------------------------------------------
.../com/cloud/agent/manager/AgentManagerImpl.java | 19 +++++++++-----
1 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/24b48f31/server/src/com/cloud/agent/manager/AgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
index 2286dab..3b5d433 100755
--- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -230,7 +230,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
@Override
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
-
+
final Map<String, String> configs = _configDao.getConfiguration("AgentManager", params);
_port = NumbersUtil.parseInt(configs.get("port"), 8250);
final int workers = NumbersUtil.parseInt(configs.get("workers"), 5);
@@ -778,7 +778,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
if (host != null) {
agentStatusTransitTo(host, Event.AgentDisconnected, _nodeId);
}
- }
+ }
}
if (forRebalance) {
@@ -895,7 +895,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
} catch (NoTransitionException ne) {
/* Agent may be currently in status of Down, Alert, Removed, namely there is no next status for some events.
* Why this can happen? Ask God not me. I hate there was no piece of comment for code handling race condition.
- * God knew what race condition the code dealt with!
+ * God knew what race condition the code dealt with!
*/
}
@@ -1046,6 +1046,11 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
return false;
}
+ if (host.getStatus() == Status.Disconnected) {
+ s_logger.info("Host is already disconnected, no work to be done");
+ return true;
+ }
+
if (host.getStatus() != Status.Up && host.getStatus() != Status.Alert && host.getStatus() != Status.Rebalancing) {
s_logger.info("Unable to disconnect host because it is not in the correct state: host=" + hostId + "; Status=" + host.getStatus());
return false;
@@ -1197,12 +1202,12 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
}
}
Response response = null;
- response = new Response(request, answers[0], _nodeId, -1);
+ response = new Response(request, answers[0], _nodeId, -1);
try {
link.send(response.toBytes());
} catch (ClosedChannelException e) {
s_logger.debug("Failed to send startupanswer: " + e.toString());
- }
+ }
_connectExecutor.execute(new HandleAgentConnectTask(link, cmds, request));
}
@@ -1405,7 +1410,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
} else {
throw new CloudRuntimeException("Unkonwn TapAgentsAction " + action);
}
- }
+ }
return true;
}
@@ -1508,7 +1513,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
attache.setMaintenanceMode(true);
// Now cancel all of the commands except for the active one.
attache.cancelAllCommands(Status.Disconnected, false);
- }
+ }
}
@Override