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
This commit is contained in:
anthony 2011-05-06 12:26:09 -07:00
parent 95c5f0f831
commit d17678f16d
2 changed files with 26 additions and 24 deletions

View File

@ -1670,10 +1670,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

@ -134,29 +134,32 @@ 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);
}
}
if(s_logger.isTraceEnabled()) {
s_logger.trace("End scanning directly connected hosts");
}