@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 }
if (e instanceof ConnectionException) { final ConnectionException ce = (ConnectionException)e; if (ce.isSetupError()) { s_logger.warn("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + " due to " + e.getMessage()); handleDisconnectWithoutInvestigation(attache, Event.AgentDisconnected, true, true);
@Override public void processConnect(final Host host, final StartupCommand cmd, final boolean forRebalance) throws ConnectionException { final List<DomainRouterVO> routers = _routerDao.listIsolatedByHostId(host.getId()); for (DomainRouterVO router : routers) { if (router.isStopPending()) { s_logger.info("Stopping router " + router.getInstanceName() + " due to stop pending flag found!"); final VirtualMachine.State state = router.getState(); if (state != VirtualMachine.State.Stopped && state != VirtualMachine.State.Destroyed) { try { stopRouter(router.getId(), false); } catch (final ResourceUnavailableException e) { s_logger.warn("Fail to stop router " + router.getInstanceName(), e); throw new ConnectionException(false, "Fail to stop router " + router.getInstanceName()); } catch (final ConcurrentOperationException e) { s_logger.warn("Fail to stop router " + router.getInstanceName(), e); throw new ConnectionException(false, "Fail to stop router " + router.getInstanceName()); } } router.setStopPending(false); router = _routerDao.persist(router); } } }
_hostDao.update(host.getId(), host); if (((SetupAnswer)answer).needReconnect()) { throw new ConnectionException(false, "Reinitialize agent after setup."); s_logger.warn("Unable to setup agent " + agentId + " because it timed out", e); throw new ConnectionException(true, "Reinitialize agent after setup.");
_hostDao.update(host.getId(), host); if (answer.needReconnect()) { throw new ConnectionException(false, "Reinitialize agent after setup."); s_logger.warn("Unable to setup agent " + agentId + " because it timed out", e); throw new ConnectionException(true, "Reinitialize agent after setup.");
throw new ConnectionException(true, "Unable to get an answer to the CheckNetworkCommand from agent: " + host.getId()); final String msg = "Incorrect Network setup on agent, Reinitialize agent after network names are setup, details : " + answer.getDetails(); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, dcId, host.getPodId(), msg, msg); throw new ConnectionException(true, msg); } else { if (answer.needReconnect()) { throw new ConnectionException(false, "Reinitialize agent after network setup.");
throw new ConnectionException(true, "Unable to prepare OCFS2 nodes for pool " + pool.getId()); _storageManager.createCapacityEntry(pool.getId()); } catch (Exception e) { throw new ConnectionException(true, "Unable to connect host " + hostId + " to storage pool id " + pool.getId() + " due to " + e.toString(), e);
throw new ConnectionException(true, "Unable to setup the local storage pool for " + host, e);