mirror of https://github.com/apache/cloudstack.git
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.
This commit is contained in:
parent
fff763ef81
commit
86bbe211f2
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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!");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue