Eliminate the initialize call if we know someone else is connecting to a host

This commit is contained in:
Alex Huang 2011-05-06 09:50:10 -07:00
parent 80b6df17b9
commit 08bb454241
1 changed files with 10 additions and 2 deletions

View File

@ -1809,13 +1809,21 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
}
protected AgentAttache simulateStart(Long id, ServerResource resource, Map<String, String> details, boolean old, List<String> hostTags, String allocationState) throws IllegalArgumentException {
HostVO host = null;
if (id != null) {
host = _hostDao.findById(id);
if (host.getManagementServerId() != null) {
s_logger.info("MS " + host.getManagementServerId() + " is loading " + host);
return null;
}
}
StartupCommand[] cmds = resource.initialize();
if (cmds == null) {
return null;
}
if (id != null) {
HostVO host = _hostDao.findById(id);
if (host != null) {
if (!_hostDao.directConnect(host, _nodeId)) {
s_logger.info("Someone else is loading " + host);
resource.disconnected();