cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yas...@apache.org
Subject git commit: updated refs/heads/4.2 to 8829826
Date Wed, 17 Jul 2013 00:26:39 GMT
Updated Branches:
  refs/heads/4.2 e18ca0117 -> 882982605


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/88298260
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/88298260
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/88298260

Branch: refs/heads/4.2
Commit: 882982605ae7c05ca282597556f26d2f10952df4
Parents: e18ca01
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:16:58 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/88298260/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/88298260/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/88298260/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 a24300e..1ca1177 100644
--- a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
@@ -207,7 +207,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) {
@@ -453,7 +453,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