Skip to content

Commit a82ee77

Browse files
author
Sheng Yang
committed
CLOUDSTACK-191: Update checking for updateCustomerGateway
Reviewed-by: Anthony Xu Conflicts: server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
1 parent 3a313ee commit a82ee77

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,12 +468,14 @@ public Site2SiteCustomerGateway updateCustomerGateway(UpdateVpnCustomerGatewayCm
468468
}
469469

470470
checkCustomerGatewayCidrList(guestCidrList);
471-
471+
472472
long accountId = gw.getAccountId();
473-
if (_customerGatewayDao.findByGatewayIp(gatewayIp) != null) {
473+
Site2SiteCustomerGatewayVO existedGw = _customerGatewayDao.findByGatewayIp(gatewayIp);
474+
if (existedGw != null && existedGw.getId() != gw.getId()) {
474475
throw new InvalidParameterValueException("The customer gateway with ip " + gatewayIp + " already existed in the system!");
475476
}
476-
if (_customerGatewayDao.findByNameAndAccountId(name, accountId) != null) {
477+
existedGw = _customerGatewayDao.findByNameAndAccountId(name, accountId);
478+
if (existedGw != null && existedGw.getId() != gw.getId()) {
477479
throw new InvalidParameterValueException("The customer gateway with name " + name + " already existed!");
478480
}
479481

0 commit comments

Comments
 (0)