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 2018/10/17 14:57:20 UTC

[cloudstack] branch 4.11 updated: network: Allow ability to disable rolling restart feature (#2900)

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

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


The following commit(s) were added to refs/heads/4.11 by this push:
     new 5ce14df  network: Allow ability to disable rolling restart feature (#2900)
5ce14df is described below

commit 5ce14df31fa0477c1709d49c0a7b61e0f5c0ea7c
Author: Rohit Yadav <ro...@apache.org>
AuthorDate: Wed Oct 17 20:27:08 2018 +0530

    network: Allow ability to disable rolling restart feature (#2900)
    
    This adds a global setting for admins who may not want the rolling
    restart of routers or are seeing any issues around it. In future, this
    setting may be removed.
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 .../orchestration/service/NetworkOrchestrationService.java   |  3 +++
 .../cloudstack/engine/orchestration/NetworkOrchestrator.java | 12 ++++++++++--
 server/src/com/cloud/network/vpc/VpcManagerImpl.java         |  7 +++++++
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
index 82d0566..fa7601d 100644
--- a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
+++ b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
@@ -93,6 +93,9 @@ public interface NetworkOrchestrationService {
     ConfigKey<Boolean> ForgedTransmits = new ConfigKey<Boolean>("Advanced", Boolean.class, "network.forged.transmits", "true",
             "Whether to allow or deny forged transmits on nics for applicable network elements such as for vswitch/dvswitch portgroups.", true);
 
+    ConfigKey<Boolean> RollingRestartEnabled = new ConfigKey<Boolean>("Advanced", Boolean.class, "network.rolling.restart", "true",
+            "Whether to allow or deny rolling restart of network routers.", true);
+
     List<? extends Network> setupNetwork(Account owner, NetworkOffering offering, DeploymentPlan plan, String name, String displayText, boolean isDefault)
         throws ConcurrentOperationException;
 
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index 5b27203..55015ce 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -2860,7 +2860,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         s_logger.debug("Implementing the network " + network + " elements and resources as a part of network restart without cleanup");
         try {
             implementNetworkElementsAndResources(dest, context, network, offering);
-            setRestartRequired(network, true);
+            setRestartRequired(network, false);
             return true;
         } catch (final Exception ex) {
             s_logger.warn("Failed to implement network " + network + " elements and resources as a part of network restart due to ", ex);
@@ -2927,6 +2927,14 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
      * @throws InsufficientCapacityException
      */
     private boolean rollingRestartRouters(final NetworkVO network, final NetworkOffering offering, final DeployDestination dest, final ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {
+        if (!NetworkOrchestrationService.RollingRestartEnabled.value()) {
+            if (shutdownNetworkElementsAndResources(context, true, network)) {
+                implementNetworkElementsAndResources(dest, context, network, offering);
+                return true;
+            }
+            s_logger.debug("Failed to shutdown the network elements and resources as a part of network restart: " + network.getState());
+            return false;
+        }
         s_logger.debug("Performing rolling restart of routers of network " + network);
         destroyExpendableRouters(_routerDao.findByNetwork(network.getId()), context);
 
@@ -3831,6 +3839,6 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
     public ConfigKey<?>[] getConfigKeys() {
         return new ConfigKey<?>[] {NetworkGcWait, NetworkGcInterval, NetworkLockTimeout,
                 GuestDomainSuffix, NetworkThrottlingRate, MinVRVersion,
-                PromiscuousMode, MacAddressChanges, ForgedTransmits};
+                PromiscuousMode, MacAddressChanges, ForgedTransmits, RollingRestartEnabled};
     }
 }
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index b32498b..b8a797b 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -2458,6 +2458,13 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
      * @throws InsufficientCapacityException
      */
     private boolean rollingRestartVpc(final Vpc vpc, final ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {
+        if (!NetworkOrchestrationService.RollingRestartEnabled.value()) {
+            if (shutdownVpc(vpc.getId())) {
+                return startVpc(vpc.getId(), false);
+            }
+            s_logger.warn("Failed to shutdown vpc as a part of VPC " + vpc + " restart process");
+            return false;
+        }
         s_logger.debug("Performing rolling restart of routers of VPC " + vpc);
         _ntwkMgr.destroyExpendableRouters(_routerDao.listByVpcId(vpc.getId()), context);