bug 6521: for add host, return api response, even if the host is in disconnected state

status 6521: resolved fixed
This commit is contained in:
anthony 2010-10-12 17:57:57 -07:00
parent 7c51a661df
commit 310556ecf2
2 changed files with 12 additions and 6 deletions

View File

@ -124,6 +124,10 @@ public abstract class AgentAttache {
_status = Status.Up;
}
public boolean isReady() {
return _status == Status.Up;
}
public boolean isConnecting() {
return _status == Status.Connecting;
}

View File

@ -903,7 +903,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 null;
return attache;
}
}
}
@ -1034,12 +1034,14 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
resource.disconnected();
return null;
}
StartupAnswer[] answers = new StartupAnswer[cmds.length];
for (int i = 0; i < answers.length; i++) {
answers[i] = new StartupAnswer(cmds[i], attache.getId(), _pingInterval);
if( attache.isReady()) {
StartupAnswer[] answers = new StartupAnswer[cmds.length];
for (int i = 0; i < answers.length; i++) {
answers[i] = new StartupAnswer(cmds[i], attache.getId(), _pingInterval);
}
attache.process(answers);
}
attache.process(answers);
return attache;
}