incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yas...@apache.org
Subject [4/5] git commit: CS-16043: Using network based router rather than account for RVR detection
Date Sat, 18 Aug 2012 00:00:38 GMT
CS-16043: Using network based router rather than account for RVR detection


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

Branch: refs/heads/master
Commit: 1cfcefd2fb15b078da4a984bf7f0ed4f4c7a91ff
Parents: ea6f3eb
Author: Sheng Yang <sheng.yang@citrix.com>
Authored: Fri Aug 17 10:30:32 2012 -0700
Committer: Sheng Yang <sheng.yang@citrix.com>
Committed: Fri Aug 17 16:52:06 2012 -0700

----------------------------------------------------------------------
 .../router/VirtualNetworkApplianceManagerImpl.java |   32 +++++++++-----
 1 files changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1cfcefd2/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 f143eb7..7cd9704 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1588,19 +1588,27 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
         DataCenterDeployment plan = new DataCenterDeployment(0, null, null, null, null, null);
         DomainRouterVO result = null;
         assert router.getIsRedundantRouter();
-        List<DomainRouterVO> routerList = _routerDao.findBy(router.getAccountId(),
router.getDataCenterIdToDeployIn());
+        List<Long> networkIds = _routerDao.getRouterNetworks(router.getId());
+        //Not support VPC now
+        if (networkIds.size() > 1) {
+            throw new ResourceUnavailableException("Unable to support more than one guest
network for redundant router now!",
+                    DataCenter.class, router.getDataCenterIdToDeployIn());
+        }
         DomainRouterVO routerToBeAvoid = null;
-        for (DomainRouterVO rrouter : routerList) {
-            if (rrouter.getHostId() != null && rrouter.getIsRedundantRouter() &&
rrouter.getState() == State.Running) {
-                if (routerToBeAvoid != null) {
-                    throw new ResourceUnavailableException("Try to start router " + router.getInstanceName()
+ "(" + router.getId() + ")"
-                            + ", but there are already two redundant routers with IP " +
router.getPublicIpAddress()
-                            + ", they are " + rrouter.getInstanceName() + "(" + rrouter.getId()
+ ") and "
-                            + routerToBeAvoid.getInstanceName() + "(" + routerToBeAvoid.getId()
+ ")",
-                            DataCenter.class, rrouter.getDataCenterIdToDeployIn());
-                }
-                routerToBeAvoid = rrouter;
-            }
+        if (networkIds.size() != 0)  {
+            List<DomainRouterVO> routerList = _routerDao.findByNetwork(networkIds.get(0));
+            for (DomainRouterVO rrouter : routerList) {
+                if (rrouter.getHostId() != null && rrouter.getIsRedundantRouter()
&& rrouter.getState() == State.Running) {
+                    if (routerToBeAvoid != null) {
+                        throw new ResourceUnavailableException("Try to start router " + router.getInstanceName()
+ "(" + router.getId() + ")"
+                                + ", but there are already two redundant routers with IP
" + router.getPublicIpAddress()
+                                + ", they are " + rrouter.getInstanceName() + "(" + rrouter.getId()
+ ") and "
+                                + routerToBeAvoid.getInstanceName() + "(" + routerToBeAvoid.getId()
+ ")",
+                                DataCenter.class, rrouter.getDataCenterIdToDeployIn());
+                    }
+                    routerToBeAvoid = rrouter;
+                }
+            }
         }
         if (routerToBeAvoid == null) {
             return this.start(router, user, caller, params, null); 


Mime
View raw message