cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wilderrodrigues <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-9114: restartnetwork with clea...
Date Thu, 10 Dec 2015 08:59:45 GMT
Github user wilderrodrigues commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1198#discussion_r47201935
  
    --- Diff: engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
---
    @@ -2558,6 +2575,62 @@ public boolean restartNetwork(Long networkId, Account callerAccount,
User caller
             }
         }
     
    +    /* If there are redundant routers in the isolated network, we follow the steps to
make the network working better
    +     *  (1) destroy backup router if exists
    +     *  (2) create new backup router
    +     *  (3) destroy master router (then the backup will become master)
    +     *  (4) create a new router as backup router.
    +     */
    +    private boolean restartGuestNetworkWithRedundantRouters(NetworkVO network, List<DomainRouterVO>
routers, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException,
InsufficientCapacityException {
    +        Account caller = CallContext.current().getCallingAccount();
    +        long callerUserId = CallContext.current().getCallingUserId();
    +
    +        // check the master and backup redundant state
    +        DomainRouterVO masterRouter = null;
    +        DomainRouterVO backupRouter = null;
    +        if (routers != null && routers.size() == 1) {
    +            masterRouter = routers.get(0);
    +        } if (routers != null && routers.size() == 2) {
    +            DomainRouterVO router1 = routers.get(0);
    +            DomainRouterVO router2 = routers.get(1);
    +            if (router1.getRedundantState() == RedundantState.MASTER || router2.getRedundantState()
== RedundantState.BACKUP) {
    +                masterRouter = router1;
    +                backupRouter = router2;
    +            } else if (router1.getRedundantState() == RedundantState.BACKUP || router2.getRedundantState()
== RedundantState.MASTER) {
    +                masterRouter = router2;
    +                backupRouter = router1;
    +            } else { // both routers are in UNKNOWN state
    +                masterRouter = router1;
    +                backupRouter = router2;
    +            }
    +        }
    +
    +        NetworkOfferingVO offering = _networkOfferingDao.findByIdIncludingRemoved(network.getNetworkOfferingId());
    +        DeployDestination dest = new DeployDestination(_dcDao.findById(network.getDataCenterId()),
null, null, null);
    +        List<Provider> providersToImplement = getNetworkProviders(network.getId());
    +
    +        // destroy backup router
    +        if (backupRouter != null) {
    +            _routerService.destroyRouter(backupRouter.getId(), caller, callerUserId);
    +        }
    +        // create new backup router
    +        implementNetworkElements(dest, context, network, offering, providersToImplement);
    +
    +        // destroy master router
    +        if (masterRouter != null) {
    +            try {
    +                Thread.sleep(10000); // wait 10s for the keepalived/conntrackd on backup
router
    --- End diff --
    
    The ```implementNetworkElements()``` is a blocking call. So, you don't need the sleep
here. Even if you would, 10 seconds is way too much.
    
    I would suggest that first you destroy the master router! The back becomes master in no
time, so no sleep needed. Then you spin up a new router (which will be backup, and destroy
the previous (old) master. Serious, no sleep needed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message