mirror of https://github.com/apache/cloudstack.git
bug 6462: notifyMonitorsOfConnection of handleDirectConnect may fail, but it still returns the removed attach, and lauch ping task
status 6462: resolved fixed
This commit is contained in:
parent
cfebc04ddb
commit
0c750aa8fa
|
|
@ -482,9 +482,9 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
|
|||
|
||||
AgentAttache attache = createAttache(id, server, resource);
|
||||
if (!resource.IsRemoteAgent())
|
||||
notifyMonitorsOfConnection(attache, startup);
|
||||
attache = notifyMonitorsOfConnection(attache, startup);
|
||||
else {
|
||||
_hostDao.updateStatus(server, Event.AgentConnected, _nodeId);
|
||||
_hostDao.updateStatus(server, Event.AgentConnected, _nodeId);
|
||||
}
|
||||
return attache;
|
||||
}
|
||||
|
|
@ -896,14 +896,12 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
|
|||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Deregistering link for " + hostId + " with state " + nextState);
|
||||
}
|
||||
|
||||
_hostDao.disconnect(host, event, _nodeId);
|
||||
|
||||
synchronized (_agents) {
|
||||
AgentAttache removed = _agents.remove(hostId);
|
||||
if (removed != null && removed != attache) { // NOTE: == is intentionally used here.
|
||||
_agents.put(removed.getId(), removed);
|
||||
}
|
||||
}
|
||||
|
||||
_hostDao.disconnect(host, event, _nodeId);
|
||||
host = _hostDao.findById(host.getId());
|
||||
if (host.getStatus() == Status.Alert || host.getStatus() == Status.Down) {
|
||||
_haMgr.scheduleRestartForVmsOnHost(host);
|
||||
|
|
@ -920,7 +918,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected void notifyMonitorsOfConnection(AgentAttache attache, final StartupCommand[] cmd) {
|
||||
protected AgentAttache notifyMonitorsOfConnection(AgentAttache attache, final StartupCommand[] cmd) {
|
||||
long hostId = attache.getId();
|
||||
HostVO host = _hostDao.findById(hostId);
|
||||
for (Pair<Integer, Listener> monitor : _hostMonitors) {
|
||||
|
|
@ -931,7 +929,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
|
|||
if (!monitor.second().processConnect(host, cmd[i])) {
|
||||
s_logger.info("Monitor " + monitor.second().getClass().getSimpleName() + " says not to continue the connect process for " + hostId);
|
||||
handleDisconnect(attache, Event.AgentDisconnected, false);
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -941,11 +939,12 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
|
|||
Answer answer = easySend(hostId, ready);
|
||||
if (answer == null) {
|
||||
handleDisconnect(attache, Event.AgentDisconnected, false);
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
_hostDao.updateStatus(host, Event.Ready, _nodeId);
|
||||
attache.ready();
|
||||
return attache;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1597,7 +1596,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
|
|||
|
||||
AgentAttache attache = createAttache(id, server, link);
|
||||
|
||||
notifyMonitorsOfConnection(attache, startup);
|
||||
attache = notifyMonitorsOfConnection(attache, startup);
|
||||
|
||||
return attache;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue