1. in 2.1.x some hosts don't have cluster.guid in host_details

2. loading one host failure should not affect loading other hosts

Conflicts:

	server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
This commit is contained in:
anthony 2011-05-06 12:35:51 -07:00
parent fc0bb46f10
commit 330f1815fa
2 changed files with 21 additions and 19 deletions

View File

@ -1785,10 +1785,9 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
} else {
guid = cluster.getGuid();
}
if (guid == null || guid.isEmpty()) {
throw new CloudRuntimeException("Can not find guid for cluster " + cluster.getId() + " name " + cluster.getName());
if (guid != null && !guid.isEmpty()) {
params.put("pool", guid);
}
params.put("pool", guid);
}
params.put("ipaddress", host.getPrivateIpAddress());

View File

@ -127,26 +127,29 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
}
}
}
if(hosts != null && hosts.size() > 0) {
for(HostVO host: hosts) {
AgentAttache agentattache = findAttache(host.getId());
if(agentattache != null) {
// already loaded, skip
if(agentattache.forForward()) {
if(s_logger.isInfoEnabled()) {
s_logger.info(host + " is detected down, but we have a forward attache running, disconnect this one before launching the host");
if (hosts != null && hosts.size() > 0) {
for (HostVO host : hosts) {
try {
AgentAttache agentattache = findAttache(host.getId());
if (agentattache != null) {
// already loaded, skip
if (agentattache.forForward()) {
if (s_logger.isInfoEnabled()) {
s_logger.info(host + " is detected down, but we have a forward attache running, disconnect this one before launching the host");
}
removeAgent(agentattache, Status.Disconnected);
} else {
continue;
}
removeAgent(agentattache, Status.Disconnected);
} else {
continue;
}
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("Loading directly connected host " + host.getId() + "(" + host.getName() + ")");
if (s_logger.isDebugEnabled()) {
s_logger.debug("Loading directly connected host " + host.getId() + "(" + host.getName() + ")");
}
loadDirectlyConnectedHost(host);
} catch (Throwable e) {
s_logger.debug(" can not load directly connected host " + host.getId() + "(" + host.getName() + ") due to " + e.toString());
}
loadDirectlyConnectedHost(host);
}
}