cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ro...@apache.org
Subject [cloudstack] branch master updated: CLOUDSTACK-10077: allow to have different VPN customer gateway configs for same gateway IP (#2267)
Date Mon, 11 Dec 2017 16:28:26 GMT
This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new e5f0a68a CLOUDSTACK-10077: allow to have different VPN customer gateway configs for
same gateway IP (#2267)
e5f0a68a is described below

commit e5f0a68a4d5cbd520b9043a1e62959328a52f2af
Author: René Moser <mail@renemoser.net>
AuthorDate: Mon Dec 11 17:28:21 2017 +0100

    CLOUDSTACK-10077: allow to have different VPN customer gateway configs for same gateway
IP (#2267)
    
    Related https://github.com/apache/cloudstack/commit/86bbe211f2341d52d1d64b0b6d3abcdcef85d3ee
and CLOUDSTACK-494. Currently we can not have serveral VPCs in one account with different
VPN customer gateways configuration per same gateway IP.
---
 .../com/cloud/network/dao/Site2SiteCustomerGatewayDao.java   |  2 --
 .../cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java   | 12 ------------
 .../src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java   |  9 +--------
 3 files changed, 1 insertion(+), 22 deletions(-)

diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java
index afcd4b6..d0439a5 100644
--- a/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java
@@ -21,8 +21,6 @@ import java.util.List;
 import com.cloud.utils.db.GenericDao;
 
 public interface Site2SiteCustomerGatewayDao extends GenericDao<Site2SiteCustomerGatewayVO,
Long> {
-    Site2SiteCustomerGatewayVO findByGatewayIpAndAccountId(String ip, long accountId);
-
     Site2SiteCustomerGatewayVO findByNameAndAccountId(String name, long accountId);
 
     List<Site2SiteCustomerGatewayVO> listByAccountId(long accountId);
diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java
b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java
index 4db826b..3aad27c 100644
--- a/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java
@@ -18,8 +18,6 @@ package com.cloud.network.dao;
 
 import java.util.List;
 
-
-import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
 import com.cloud.utils.db.GenericDaoBase;
@@ -28,8 +26,6 @@ import com.cloud.utils.db.SearchCriteria;
 
 @Component
 public class Site2SiteCustomerGatewayDaoImpl extends GenericDaoBase<Site2SiteCustomerGatewayVO,
Long> implements Site2SiteCustomerGatewayDao {
-    private static final Logger s_logger = Logger.getLogger(Site2SiteCustomerGatewayDaoImpl.class);
-
     private final SearchBuilder<Site2SiteCustomerGatewayVO> AllFieldsSearch;
 
     protected Site2SiteCustomerGatewayDaoImpl() {
@@ -41,14 +37,6 @@ public class Site2SiteCustomerGatewayDaoImpl extends GenericDaoBase<Site2SiteCus
     }
 
     @Override
-    public Site2SiteCustomerGatewayVO findByGatewayIpAndAccountId(String ip, long accountId)
{
-        SearchCriteria<Site2SiteCustomerGatewayVO> sc = AllFieldsSearch.create();
-        sc.setParameters("gatewayIp", ip);
-        sc.setParameters("accountId", accountId);
-        return findOneBy(sc);
-    }
-
-    @Override
     public Site2SiteCustomerGatewayVO findByNameAndAccountId(String name, long accountId)
{
         SearchCriteria<Site2SiteCustomerGatewayVO> sc = AllFieldsSearch.create();
         sc.setParameters("name", name);
diff --git a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
index ba8c1d1..f188ad3 100644
--- a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
@@ -224,9 +224,6 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
         }
 
         long accountId = owner.getAccountId();
-        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) {
             throw new InvalidParameterValueException("The customer gateway with name " +
name + " already existed!");
         }
@@ -480,11 +477,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
         checkCustomerGatewayCidrList(guestCidrList);
 
         long accountId = gw.getAccountId();
-        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!");
-        }
-        existedGw = _customerGatewayDao.findByNameAndAccountId(name, accountId);
+        Site2SiteCustomerGatewayVO existedGw = _customerGatewayDao.findByNameAndAccountId(name,
accountId);
         if (existedGw != null && existedGw.getId() != gw.getId()) {
             throw new InvalidParameterValueException("The customer gateway with name " +
name + " already existed!");
         }

-- 
To stop receiving notification emails like this one, please contact
['"commits@cloudstack.apache.org" <commits@cloudstack.apache.org>'].

Mime
View raw message