[ https://issues.apache.org/jira/browse/CLOUDSTACK-9114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16467294#comment-16467294 ]
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_r186698162 ########## File path: engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java ########## @@ -2868,6 +2849,89 @@ public boolean restartNetwork(final Long networkId, final Account callerAccount, } } + @Override + public void destroyExpendableRouters(final List<? extends VirtualRouter> routers, final ReservationContext context) throws ResourceUnavailableException { + final List<VirtualRouter> remainingRouters = new ArrayList<>(); + for (final VirtualRouter router : routers) { + if (router.getState() == VirtualMachine.State.Stopped || + router.getState() == VirtualMachine.State.Error || + router.getState() == VirtualMachine.State.Shutdowned || + router.getState() == VirtualMachine.State.Unknown) { + s_logger.debug("Destroying old router " + router); + _routerService.destroyRouter(router.getId(), context.getAccount(), context.getCaller().getId()); + } else { + remainingRouters.add(router); + } + } + + if (remainingRouters.size() < 2) { + return; + } + + VirtualRouter backupRouter = null; + for (final VirtualRouter router : remainingRouters) { + if (router.getRedundantState() == VirtualRouter.RedundantState.BACKUP) { + backupRouter = router; Review comment: Are these routers ordered some how? I mean, reading your next discussion with @DaanHoogland, it seems that the router we do not need will always be the last one (the third or fourth one) when this code is executed. Therefore, there must be some way to order this list before you reach here, right? ---------------------------------------------------------------- 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)