You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2012/10/05 00:40:40 UTC

git commit: CLOUDSTACK-191: Update checking for updateCustomerGateway

Updated Branches:
  refs/heads/4.0 1ff798ca7 -> a43834674


CLOUDSTACK-191: Update checking for updateCustomerGateway

Reviewed-by: Anthony Xu

Conflicts:

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


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/a4383467
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a4383467
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a4383467

Branch: refs/heads/4.0
Commit: a4383467455553671242ea64bcdb4d05823c5fd3
Parents: 1ff798c
Author: Sheng Yang <sh...@citrix.com>
Authored: Mon Sep 24 16:39:01 2012 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Thu Oct 4 15:40:14 2012 -0700

----------------------------------------------------------------------
 .../cloud/network/vpn/Site2SiteVpnManagerImpl.java |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a4383467/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
index db678ae..ae0f4ec 100644
--- a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
@@ -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!");
         }