private HostVO getNewHost(StartupCommand[] startupCommands) { StartupCommand startupCommand = startupCommands[0]; HostVO host = findHostByGuid(startupCommand.getGuid()); if (host != null) { return host; } host = findHostByGuid(startupCommand.getGuidWithoutResource()); if (host != null) { return host; } return null; }
@Override public boolean processInitialConnect(StartupCommand[] cmd) throws ConnectionException { try { authorizeAgent(cmd); } catch (AgentAuthnException e) { throw new ConnectionException(true, "Failed to authenticate/authorize", e); } s_logger.debug("Authorized agent with guid " + cmd[0].getGuid()); return false;//so that the next host creator can process it }
private void markHostAsDisconnected(HostVO host, final StartupCommand[] cmds) { if (host == null) { // in case host is null due to some errors, try // reloading the host from db if (cmds != null) { final StartupCommand firstCmd = cmds[0]; host = findHostByGuid(firstCmd.getGuid()); if (host == null) { host = findHostByGuid(firstCmd.getGuidWithoutResource()); } } } if (host != null) { // Change agent status to Alert, so that host is considered for // reconnection next time _agentMgr.agentStatusTransitTo(host, Status.Event.AgentDisconnected, _nodeId); } }
host = new HostVO(startup.getGuid());
host = findHostByGuid(firstCmd.getGuid()); if (host == null) { host = findHostByGuid(firstCmd.getGuidWithoutResource()); s_logger.debug("Found the host " + host.getId() + " by guid: " + firstCmd.getGuid() + ", old host reconnected as new"); hostExists = true; // ensures that host status is left unchanged in case of adding same one again return null;