continue; if(router.getRedundantState()!=VirtualRouter.RedundantState.BACKUP) { masterRouters.add(router); routers.remove(router);
DomainRouterVO backupRouter = null; for (final DomainRouterVO r : checkingRouters) { if (r.getRedundantState() == RedundantState.MASTER) { if (masterRouter == null) { masterRouter = r; } else if (r.getRedundantState() == RedundantState.BACKUP) { if (backupRouter == null) { backupRouter = r;
@Override public boolean canUpdateInSequence(Network network, boolean forced){ List<Provider> providers = getNetworkProviders(network.getId()); //check if the there are no service provider other than virtualrouter. for(Provider provider : providers) { if (provider != Provider.VirtualRouter) throw new UnsupportedOperationException("Cannot update the network resources in sequence when providers other than virtualrouter are used"); } //check if routers are in correct state before proceeding with the update List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), VirtualRouter.Role.VIRTUAL_ROUTER); for (DomainRouterVO router : routers){ if (router.getRedundantState() == VirtualRouter.RedundantState.UNKNOWN) { if (!forced) { throw new CloudRuntimeException("Domain router: "+router.getInstanceName()+" is in unknown state, Cannot update network. set parameter forced to true for forcing an update"); } } } return true; }
private void checkDuplicateMaster(final List<DomainRouterVO> routers) { final Map<Long, DomainRouterVO> networkRouterMaps = new HashMap<Long, DomainRouterVO>(); for (final DomainRouterVO router : routers) { final List<Long> routerGuestNtwkIds = _routerDao.getRouterNetworks(router.getId()); for (final Long routerGuestNtwkId : routerGuestNtwkIds) { if (router.getRedundantState() == RedundantState.MASTER) { if (networkRouterMaps.containsKey(routerGuestNtwkId)) { final DomainRouterVO dupRouter = networkRouterMaps.get(routerGuestNtwkId); final String title = "More than one redundant virtual router is in MASTER state! Router " + router.getHostName() + " and router " + dupRouter.getHostName(); final String context = "Virtual router (name: " + router.getHostName() + ", id: " + router.getId() + " and router (name: " + dupRouter.getHostName() + ", id: " + router.getId() + ") are both in MASTER state! If the problem persist, restart both of routers. "; _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER, router.getDataCenterId(), router.getPodIdToDeployIn(), title, context); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER, dupRouter.getDataCenterId(), dupRouter.getPodIdToDeployIn(), title, context); s_logger.warn(context); } else { networkRouterMaps.put(routerGuestNtwkId, router); } } } } }
continue; final RedundantState prevState = router.getRedundantState(); if (router.getState() != VirtualMachine.State.Running) { router.setRedundantState(RedundantState.UNKNOWN); _routerDao.update(router.getId(), router); final RedundantState currState = router.getRedundantState(); if (prevState != currState) { final String title = "Redundant virtual router " + router.getInstanceName() + " just switch from " + prevState + " to " + currState;
continue; if (router.getIsRedundantRouter() && router.getRedundantState() != RedundantState.MASTER){ continue;