File tree Expand file tree Collapse file tree
engine/schema/src/com/cloud/network/dao
server/src/com/cloud/network/vpn Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121import com .cloud .utils .db .GenericDao ;
2222
2323public interface Site2SiteCustomerGatewayDao extends GenericDao <Site2SiteCustomerGatewayVO , Long > {
24- Site2SiteCustomerGatewayVO findByGatewayIp (String ip );
24+ Site2SiteCustomerGatewayVO findByGatewayIpAndAccountId (String ip , long accountId );
2525 Site2SiteCustomerGatewayVO findByNameAndAccountId (String name , long accountId );
2626 List <Site2SiteCustomerGatewayVO > listByAccountId (long accountId );
2727}
Original file line number Diff line number Diff line change @@ -43,9 +43,10 @@ protected Site2SiteCustomerGatewayDaoImpl() {
4343 }
4444
4545 @ Override
46- public Site2SiteCustomerGatewayVO findByGatewayIp (String ip ) {
46+ public Site2SiteCustomerGatewayVO findByGatewayIpAndAccountId (String ip , long accountId ) {
4747 SearchCriteria <Site2SiteCustomerGatewayVO > sc = AllFieldsSearch .create ();
4848 sc .setParameters ("gatewayIp" , ip );
49+ sc .setParameters ("accountId" , accountId );
4950 return findOneBy (sc );
5051 }
5152
Original file line number Diff line number Diff line change @@ -208,7 +208,7 @@ public Site2SiteCustomerGateway createCustomerGateway(CreateVpnCustomerGatewayCm
208208 }
209209
210210 long accountId = owner .getAccountId ();
211- if (_customerGatewayDao .findByGatewayIp (gatewayIp ) != null ) {
211+ if (_customerGatewayDao .findByGatewayIpAndAccountId (gatewayIp , accountId ) != null ) {
212212 throw new InvalidParameterValueException ("The customer gateway with ip " + gatewayIp + " already existed in the system!" );
213213 }
214214 if (_customerGatewayDao .findByNameAndAccountId (name , accountId ) != null ) {
@@ -454,7 +454,7 @@ public Site2SiteCustomerGateway updateCustomerGateway(UpdateVpnCustomerGatewayCm
454454 checkCustomerGatewayCidrList (guestCidrList );
455455
456456 long accountId = gw .getAccountId ();
457- Site2SiteCustomerGatewayVO existedGw = _customerGatewayDao .findByGatewayIp (gatewayIp );
457+ Site2SiteCustomerGatewayVO existedGw = _customerGatewayDao .findByGatewayIpAndAccountId (gatewayIp , accountId );
458458 if (existedGw != null && existedGw .getId () != gw .getId ()) {
459459 throw new InvalidParameterValueException ("The customer gateway with ip " + gatewayIp + " already existed in the system!" );
460460 }
You can’t perform that action at this time.
0 commit comments