You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/03/17 11:26:29 UTC

[27/50] git commit: updated refs/heads/master to 3c429ee

Fix checkSanity. We do not need to check the priority anymore.
   - It's taken care by VRRP.

wip: clean up where priority is still used.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3af2ce3f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3af2ce3f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3af2ce3f

Branch: refs/heads/master
Commit: 3af2ce3f50406e88780c7117806040fe9db624c2
Parents: 57d3ffa
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Fri Feb 6 14:12:40 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:03 2015 +0100

----------------------------------------------------------------------
 .../VirtualNetworkApplianceManagerImpl.java     | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3af2ce3f/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 1ad7a9f..588a354 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1077,10 +1077,19 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                         continue;
                     }
                     checkedNetwork.add(routerGuestNtwkId);
-                    final List<DomainRouterVO> checkingRouters = _routerDao.listByNetworkAndRole(routerGuestNtwkId, Role.VIRTUAL_ROUTER);
+                    
+                    final List<DomainRouterVO> checkingRouters;
+                    Long vpcId = router.getVpcId();
+                    if (vpcId != null) {
+                        checkingRouters = _routerDao.listByVpcId(vpcId);
+                    } else {
+                        checkingRouters = _routerDao.listByNetworkAndRole(routerGuestNtwkId, Role.VIRTUAL_ROUTER);
+                    }
+                    
                     if (checkingRouters.size() != 2) {
                         continue;
                     }
+                    
                     DomainRouterVO masterRouter = null;
                     DomainRouterVO backupRouter = null;
                     for (final DomainRouterVO r : checkingRouters) {
@@ -1088,23 +1097,22 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                             if (masterRouter == null) {
                                 masterRouter = r;
                             } else {
-                                // Duplicate master! We give up, until the admin
-                                // fix duplicate MASTER issue
+                                // Wilder Rodrigues (wrodrigues@schubergphilis.com
+                                // Force a restart in order to fix the conflict
+                                recoverRedundantNetwork(masterRouter, r);
                                 break;
                             }
                         } else if (r.getRedundantState() == RedundantState.BACKUP) {
                             if (backupRouter == null) {
                                 backupRouter = r;
                             } else {
+                                // Wilder Rodrigues (wrodrigues@schubergphilis.com
+                                // Do we have 2 routers in Backup state? Perhaps a restart of 1 router is needed.
+                                recoverRedundantNetwork(backupRouter, r);
                                 break;
                             }
                         }
                     }
-                    if (masterRouter != null && backupRouter != null) {
-                        if (_nwHelper.getRealPriority(masterRouter) - DEFAULT_DELTA + 1 != _nwHelper.getRealPriority(backupRouter) || backupRouter.getIsPriorityBumpUp()) {
-                            recoverRedundantNetwork(masterRouter, backupRouter);
-                        }
-                    }
                 }
             }
         }