You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/10/29 10:50:52 UTC

[cloudstack] branch 4.14 updated: FIX s2svpn connection stuck on Pending state (#4429)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.14
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.14 by this push:
     new 4cd9886  FIX s2svpn connection stuck on Pending state (#4429)
4cd9886 is described below

commit 4cd9886a89a82e099235fd0c5d2bf210d125ada9
Author: Rakesh <ra...@gmail.com>
AuthorDate: Thu Oct 29 11:50:28 2020 +0100

    FIX s2svpn connection stuck on Pending state (#4429)
    
    When we try to reset the site 2 site vpn connection while
    the VR's are being restarted, the connection enters the
    PENDING state and we cant reset the connection.
    
    So change the state from PENDING to disconnected.
    
    Steps to reproduce the issue
    
    1.create a VPC with a tier (vpc-001-001 in vpc-001), create a vm
    2.create a VPC with a tier (vpc-002-001 in vpc-002) with different cidr, create a vm
    3.create custom gateway for both vpn
    4.enable site-to-site vpn on both vpn, and add vpn connection to each other. both should be "Connected"
    5.restart vpc-001 with cleanup and monitor it
    6.when the first router is destroyed, go to site-to-site vpn page and reset vpn connection.
    7.we will get an error "Resource [DataCenter:1] is unreachable: Unable to apply site 2 site VPN configuration, virtual router is not in the right state"
    and vpn connection is stuck at Pending
    8.When vpc is restarted, go to site-to-site vpn page and reset vpn connection.
    
    Co-authored-by: Rakesh Venkatesh <r....@global.leaseweb.com>
---
 .../src/main/java/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java b/server/src/main/java/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
index aebc871..7fd3473 100644
--- a/server/src/main/java/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
+++ b/server/src/main/java/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
@@ -562,9 +562,9 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
         _accountMgr.checkAccess(caller, null, false, conn);
 
         if (conn.getState() == State.Pending) {
-            throw new InvalidParameterValueException("VPN connection " + id + " cannot be reseted when state is Pending!");
+            conn.setState(State.Disconnected);
         }
-        if (conn.getState() == State.Connected || conn.getState() == State.Error) {
+        if (conn.getState() == State.Connected || conn.getState() == State.Error || conn.getState() == State.Disconnected) {
             stopVpnConnection(id);
         }
         startVpnConnection(id);