[ https://issues.apache.org/jira/browse/CLOUDSTACK-9114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16418855#comment-16418855 ]
ASF GitHub Bot commented on CLOUDSTACK-9114: -------------------------------------------- rafaelweingartner commented on a change in pull request #2508: CLOUDSTACK-9114: Reduce VR downtime during network restart URL: https://github.com/apache/cloudstack/pull/2508#discussion_r178032100 ########## File path: engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java ########## @@ -2868,6 +2876,82 @@ public boolean restartNetwork(final Long networkId, final Account callerAccount, } } + @Override + public VirtualRouter findExpendableRouterForRollingRestart(final List<? extends VirtualRouter> routers) { + VirtualRouter expendableRouter = null; + if (routers != null && routers.size() > 1) { + for (final VirtualRouter router : routers) { + if (router.getRedundantState() != VirtualRouter.RedundantState.MASTER) { + expendableRouter = router; + } + } + if (expendableRouter == null) { + expendableRouter = routers.get(routers.size() - 1); + } + } + return expendableRouter; + } + + private boolean rollingRestartRouters(final NetworkVO network, final NetworkOffering offering, final List<DomainRouterVO> oldRouters, final ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException { + final Account callerAccount = CallContext.current().getCallingAccount(); + final long callerUserId = CallContext.current().getCallingUserId(); + final DeployDestination dest = new DeployDestination(_dcDao.findById(network.getDataCenterId()), null, null, null); + final List<Provider> providersToImplement = getNetworkProviders(network.getId()); + + // Find and destroy any expendable router + final VirtualRouter expendableRouter = findExpendableRouterForRollingRestart(oldRouters); + if (expendableRouter != null) { + _routerService.destroyRouter(expendableRouter.getId(), callerAccount, callerUserId); + } + final List<DomainRouterVO> remainingOldRouters = _routerDao.findByNetwork(network.getId()); + + // Create a new router + network.setRollingRestart(true); + implementNetworkElements(dest, context, network, offering, providersToImplement); + network.setRollingRestart(false); + + if (network.isRedundant()) { + try { + // For redundant network wait for 3*(1+skew_seconds) for VRRP to kick in + Thread.sleep(10000L); + } catch (final InterruptedException ignored) { Review comment: Please, do not hide exceptions. You should at least log them. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > restartnetwork with cleanup should not update/restart both routers at once > -------------------------------------------------------------------------- > > Key: CLOUDSTACK-9114 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9114 > Project: CloudStack > Issue Type: Improvement > Security Level: Public(Anyone can view this level - this is the > default.) > Reporter: Wei Zhou > Assignee: Wei Zhou > Priority: Major > > for now, restartnetwork with cleanup will stop both RVRs at first, then start > two new RVRs. > to reduce the downtime of network, we'd better restart the RVRs one by one. -- This message was sent by Atlassian JIRA (v7.6.3#76005)