cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject [2/2] git commit: updated refs/heads/master to acb4a19
Date Tue, 09 Jul 2013 12:03:46 GMT
CLOUDSTACK-2429: Multiple private gateways are allowed within a VPC. Check for conflicting
routes in all gateways when adding a new static route


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

Branch: refs/heads/master
Commit: acb4a19633b1a0d8f2ba81622ab6f5be6361fbd3
Parents: 58d6483
Author: Kishan Kavala <kishan@cloud.com>
Authored: Tue Jul 9 17:17:31 2013 +0530
Committer: Kishan Kavala <kishan@cloud.com>
Committed: Tue Jul 9 17:27:06 2013 +0530

----------------------------------------------------------------------
 .../schema/src/com/cloud/network/vpc/dao/StaticRouteDao.java   | 2 +-
 .../src/com/cloud/network/vpc/dao/StaticRouteDaoImpl.java      | 6 +++---
 server/src/com/cloud/network/vpc/VpcManagerImpl.java           | 4 +++-
 3 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/acb4a196/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDao.java b/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDao.java
index a8fbc09..041e8b8 100644
--- a/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDao.java
+++ b/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDao.java
@@ -26,7 +26,7 @@ public interface StaticRouteDao extends GenericDao<StaticRouteVO, Long>{
     
     boolean setStateToAdd(StaticRouteVO rule);
 
-    List<? extends StaticRoute> listByGatewayIdAndNotRevoked(long gatewayId);
+    List<? extends StaticRoute> listByVpcIdAndNotRevoked(long vpcId);
     
     List<StaticRouteVO> listByVpcId(long vpcId);
     

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/acb4a196/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDaoImpl.java b/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDaoImpl.java
index fac35a9..518237d 100644
--- a/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDaoImpl.java
@@ -58,7 +58,7 @@ public class StaticRouteDaoImpl extends GenericDaoBase<StaticRouteVO,
Long> impl
         AllFieldsSearch.done();
         
         NotRevokedSearch = createSearchBuilder();
-        NotRevokedSearch.and("gatewayId", NotRevokedSearch.entity().getVpcGatewayId(), Op.EQ);
+        NotRevokedSearch.and("vpcId", NotRevokedSearch.entity().getVpcId(), Op.EQ);
         NotRevokedSearch.and("state", NotRevokedSearch.entity().getState(), Op.NEQ);
         NotRevokedSearch.done();
         
@@ -82,9 +82,9 @@ public class StaticRouteDaoImpl extends GenericDaoBase<StaticRouteVO,
Long> impl
 
 
     @Override
-    public List<? extends StaticRoute> listByGatewayIdAndNotRevoked(long gatewayId)
{
+    public List<? extends StaticRoute> listByVpcIdAndNotRevoked(long vpcId) {
         SearchCriteria<StaticRouteVO> sc = NotRevokedSearch.create();
-        sc.setParameters("gatewayId", gatewayId);
+        sc.setParameters("vpcId", vpcId);
         sc.setParameters("state", StaticRoute.State.Revoke);
         return listBy(sc);
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/acb4a196/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index b2cb333..2555ef6 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -1858,7 +1858,9 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager,
VpcProvis
     }
     
     protected void detectRoutesConflict(StaticRoute newRoute) throws NetworkRuleConflictException
{
-        List<? extends StaticRoute> routes = _staticRouteDao.listByGatewayIdAndNotRevoked(newRoute.getVpcGatewayId());
+        //Multiple private gateways can exist within Vpc. Check for conflicts for all static
routes in Vpc
+        //and not just the gateway
+        List<? extends StaticRoute> routes = _staticRouteDao.listByVpcIdAndNotRevoked(newRoute.getVpcId());
         assert (routes.size() >= 1) : "For static routes, we now always first persist
the route and then check for " +
                 "network conflicts so we should at least have one rule at this point.";
         


Mime
View raw message