rhtyd closed pull request #2267: CLOUDSTACK-10077: allow to have different VPN customer gateway configs for same gateway IP URL: https://github.com/apache/cloudstack/pull/2267
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java index afcd4b608dd..d0439a523d0 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 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 4db826b6459..3aad27c3909 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 @@ import java.util.List; - -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.utils.db.GenericDaoBase; @@ -28,8 +26,6 @@ @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() { @@ -40,14 +36,6 @@ protected Site2SiteCustomerGatewayDaoImpl() { AllFieldsSearch.done(); } - @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(); diff --git a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java index ba8c1d1ade0..f188ad3545b 100644 --- a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java +++ b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java @@ -224,9 +224,6 @@ public Site2SiteCustomerGateway createCustomerGateway(CreateVpnCustomerGatewayCm } 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 Site2SiteCustomerGateway updateCustomerGateway(UpdateVpnCustomerGatewayCm 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!"); } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services