cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yas...@apache.org
Subject [1/2] git commit: updated refs/heads/4.2 to 3c8be55
Date Fri, 18 Oct 2013 02:59:14 GMT
Updated Branches:
  refs/heads/4.2 7d7bd2afd -> 3c8be550f


CLOUDSTACK-4786: Reset Redundant Router priority after all the routers are stopped

This patch would reset the priority in such condition:
1. All redundant routers are stopped, e.g. due to network GC
2. User start one VM in the network
3. The routers would be brought up with reseted priority(100 & 99).

This would resolve the issue of network GC result in lower limit of redundant router priority
reached.


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

Branch: refs/heads/4.2
Commit: 93188b449c177481cecafb35fc14f40da88ece07
Parents: 7d7bd2a
Author: Sheng Yang <sheng.yang@citrix.com>
Authored: Thu Oct 17 18:16:50 2013 -0700
Committer: Sheng Yang <sheng.yang@citrix.com>
Committed: Thu Oct 17 18:16:50 2013 -0700

----------------------------------------------------------------------
 .../debian/config/etc/init.d/cloud-early-config |  1 +
 .../VirtualNetworkApplianceManagerImpl.java     | 24 ++++++++++++++++++++
 2 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93188b44/patches/systemvm/debian/config/etc/init.d/cloud-early-config
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
index 88ecc11..d44f94d 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config
+++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
@@ -1189,6 +1189,7 @@ change_password() {
 start() {
   # Clear /tmp for file lock
   rm -f /tmp/*.lock
+  rm -f /tmp/rrouter_bumped
   local hyp=$(hypervisor)
   [ $? -ne 0 ] && log_it "Failed to detect hypervisor type, bailing out of early
init" && exit 10
   log_it "Detected that we are running inside $hyp guest"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93188b44/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 900d0c9..2baf35b 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1421,6 +1421,26 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase
implements V
         throw new CloudRuntimeException(errMsg);
     }
 
+    private void checkAndResetPriorityOfRedundantRouter(List<DomainRouterVO> routers)
{
+    	boolean allStopped = true;
+    	for (DomainRouterVO router : routers) {
+    		if (!router.getIsRedundantRouter() || router.getState() != VirtualMachine.State.Stopped)
{
+    			allStopped = false;
+    			break;
+    		}
+    	}
+    	if (!allStopped) {
+    		return;
+    	}
+    	
+    	for (DomainRouterVO router : routers) {
+    		// getUpdatedPriority() would update the value later
+    		router.setPriority(0);
+    		router.setIsPriorityBumpUp(false);
+    		_routerDao.update(router.getId(), router);
+    	}
+    }
+    
     @DB
     protected List<DomainRouterVO> findOrDeployVirtualRouterInGuestNetwork(Network
guestNetwork, DeployDestination dest, Account owner,
             boolean isRedundant, Map<Param, Object> params) throws ConcurrentOperationException,

@@ -1491,6 +1511,10 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase
implements V
             int routerCount = 1;
             if (isRedundant) {
                 routerCount = 2;
+                //Check current redundant routers, if possible(all routers are stopped),
reset the priority
+                if (routers.size() != 0) {
+              	    checkAndResetPriorityOfRedundantRouter(routers);
+                }
             }
         
                 // If old network is redundant but new is single router, then routers.size()
= 2 but routerCount = 1


Mime
View raw message