CLOUDSTACK-191: Update checking for updateCustomerGateway

Reviewed-by: Anthony Xu

Conflicts:

	server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
This commit is contained in:
Sheng Yang 2012-09-24 16:39:01 -07:00
parent 3a313ee1ff
commit a82ee7715e
1 changed files with 5 additions and 3 deletions

View File

@ -468,12 +468,14 @@ public class Site2SiteVpnManagerImpl implements Site2SiteVpnManager, Manager {
}
checkCustomerGatewayCidrList(guestCidrList);
long accountId = gw.getAccountId();
if (_customerGatewayDao.findByGatewayIp(gatewayIp) != null) {
Site2SiteCustomerGatewayVO existedGw = _customerGatewayDao.findByGatewayIp(gatewayIp);
if (existedGw != null && existedGw.getId() != gw.getId()) {
throw new InvalidParameterValueException("The customer gateway with ip " + gatewayIp + " already existed in the system!");
}
if (_customerGatewayDao.findByNameAndAccountId(name, accountId) != null) {
existedGw = _customerGatewayDao.findByNameAndAccountId(name, accountId);
if (existedGw != null && existedGw.getId() != gw.getId()) {
throw new InvalidParameterValueException("The customer gateway with name " + name + " already existed!");
}