cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chipchild...@apache.org
Subject [22/50] [abbrv] git commit: updated refs/heads/ldapplugin to 7bc705e
Date Wed, 17 Jul 2013 17:35:21 GMT
CLOUDSTACK-494: Loose the limition of same ip used by site-to-site vpn

Different account can have same remote side IP now. Of course the remote side need
to identify them and configured properly to handle it.


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

Branch: refs/heads/ldapplugin
Commit: 86bbe211f2341d52d1d64b0b6d3abcdcef85d3ee
Parents: fff763e
Author: Sheng Yang <sheng.yang@citrix.com>
Authored: Tue Jul 16 17:16:58 2013 -0700
Committer: Sheng Yang <sheng.yang@citrix.com>
Committed: Tue Jul 16 17:26:51 2013 -0700

----------------------------------------------------------------------
 .../src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java   | 2 +-
 .../com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java   | 3 ++-
 server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java    | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86bbe211/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java
index 20ef12d..26279c9 100644
--- a/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java
@@ -21,7 +21,7 @@ import java.util.List;
 import com.cloud.utils.db.GenericDao;
 
 public interface Site2SiteCustomerGatewayDao extends GenericDao<Site2SiteCustomerGatewayVO,
Long> {
-    Site2SiteCustomerGatewayVO findByGatewayIp(String ip);
+    Site2SiteCustomerGatewayVO findByGatewayIpAndAccountId(String ip, long accountId);
     Site2SiteCustomerGatewayVO findByNameAndAccountId(String name, long accountId);
     List<Site2SiteCustomerGatewayVO> listByAccountId(long accountId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86bbe211/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java
b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java
index fcb533a..635e914 100644
--- a/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java
@@ -43,9 +43,10 @@ public class Site2SiteCustomerGatewayDaoImpl extends GenericDaoBase<Site2SiteCus
     }
     
     @Override
-    public Site2SiteCustomerGatewayVO findByGatewayIp(String ip) {
+    public Site2SiteCustomerGatewayVO findByGatewayIpAndAccountId(String ip, long accountId)
{
         SearchCriteria<Site2SiteCustomerGatewayVO> sc = AllFieldsSearch.create();
         sc.setParameters("gatewayIp", ip);
+        sc.setParameters("accountId", accountId);
         return findOneBy(sc);
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86bbe211/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
index 292b73e..1a92c9b 100644
--- a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
@@ -208,7 +208,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
         }
 
         long accountId = owner.getAccountId();
-        if (_customerGatewayDao.findByGatewayIp(gatewayIp) != null) {
+        if (_customerGatewayDao.findByGatewayIpAndAccountId(gatewayIp, accountId) != null)
{
             throw new InvalidParameterValueException("The customer gateway with ip " + gatewayIp
+ " already existed in the system!");
         }
         if (_customerGatewayDao.findByNameAndAccountId(name, accountId) != null) {
@@ -454,7 +454,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
         checkCustomerGatewayCidrList(guestCidrList);
 
         long accountId = gw.getAccountId();
-        Site2SiteCustomerGatewayVO existedGw = _customerGatewayDao.findByGatewayIp(gatewayIp);
+        Site2SiteCustomerGatewayVO existedGw = _customerGatewayDao.findByGatewayIpAndAccountId(gatewayIp,
accountId);
         if (existedGw != null && existedGw.getId() != gw.getId()) {
             throw new InvalidParameterValueException("The customer gateway with ip " + gatewayIp
+ " already existed in the system!");
         }


Mime
View raw message