cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [27/41] git commit: updated refs/heads/4.4 to 010a217
Date Thu, 11 Dec 2014 16:54:07 GMT
CLOUDSTACK-7191:On restartNetwork destroy the VR immediatley, instead of
cleanup the rules then destroy

fix adds a provision to specify if cleanup is needed on network on
shutdown. VR is marked as to not to require network rules clean up on
network shutdown as the VR is destroyed and recreated.

ran the simulator tests that test network life cycle

(cherry picked from commit 67876b215ef5217b3d306b3642a38a3708a30494)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


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

Branch: refs/heads/4.4
Commit: 908ee8e01aa0bd56e957559046a5a0721a9995a2
Parents: 614ce7d
Author: Murali Reddy <muralimmreddy@gmail.com>
Authored: Mon Jul 28 16:14:50 2014 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Thu Dec 11 20:39:33 2014 +0530

----------------------------------------------------------------------
 api/src/com/cloud/network/Network.java            | 18 +++++++++++++++++-
 .../engine/orchestration/NetworkOrchestrator.java | 17 ++++++++++++++---
 2 files changed, 31 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/908ee8e0/api/src/com/cloud/network/Network.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java
index 885bffe..ce55e92 100644
--- a/api/src/com/cloud/network/Network.java
+++ b/api/src/com/cloud/network/Network.java
@@ -112,7 +112,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>,
I
     public static class Provider {
         private static List<Provider> supportedProviders = new ArrayList<Provider>();
 
-        public static final Provider VirtualRouter = new Provider("VirtualRouter", false);
+        public static final Provider VirtualRouter = new Provider("VirtualRouter", false,
false);
         public static final Provider JuniperContrailRouter = new Provider("JuniperContrailRouter",
false);
         public static final Provider JuniperContrailVpcRouter = new Provider("JuniperContrailVpcRouter",
false);
         public static final Provider JuniperSRX = new Provider("JuniperSRX", true);
@@ -136,9 +136,21 @@ public interface Network extends ControlledEntity, StateObject<Network.State>,
I
         private final String name;
         private final boolean isExternal;
 
+        // set to true, if on network shutdown resources (acquired/configured at implemented
phase) needed to cleaned up. set to false
+        // if no clean-up is required ( for e.g appliance based providers like VirtualRouter,
VM is destroyed so there is no need to cleanup).
+        private final boolean needCleanupOnShutdown;
+
         public Provider(String name, boolean isExternal) {
             this.name = name;
             this.isExternal = isExternal;
+            needCleanupOnShutdown = true;
+            supportedProviders.add(this);
+        }
+
+        public Provider(String name, boolean isExternal, boolean needCleanupOnShutdown) {
+            this.name = name;
+            this.isExternal = isExternal;
+            this.needCleanupOnShutdown = needCleanupOnShutdown;
             supportedProviders.add(this);
         }
 
@@ -150,6 +162,10 @@ public interface Network extends ControlledEntity, StateObject<Network.State>,
I
             return isExternal;
         }
 
+        public boolean cleanupNeededOnShutdown() {
+            return needCleanupOnShutdown;
+        }
+
         public static Provider getProvider(String providerName) {
             for (Provider provider : supportedProviders) {
                 if (provider.getName().equalsIgnoreCase(providerName)) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/908ee8e0/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
----------------------------------------------------------------------
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 96dafe9..20a6257 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -2075,11 +2075,24 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
     @Override
     public boolean shutdownNetworkElementsAndResources(ReservationContext context, boolean
cleanupElements, Network network) {
+
+        // get providers to shutdown
+        List<Provider> providersToShutdown = getNetworkProviders(network.getId());
+
         // 1) Cleanup all the rules for the network. If it fails, just log the failure and
proceed with shutting down
         // the elements
         boolean cleanupResult = true;
+        boolean cleanupNeeded = false;
         try {
-            cleanupResult = shutdownNetworkResources(network.getId(), context.getAccount(),
context.getCaller().getId());
+            for (Provider provider: providersToShutdown) {
+                if (provider.cleanupNeededOnShutdown()) {
+                    cleanupNeeded = true;
+                    break;
+                }
+            }
+            if (cleanupNeeded) {
+                cleanupResult = shutdownNetworkResources(network.getId(), context.getAccount(),
context.getCaller().getId());
+            }
         } catch (Exception ex) {
             s_logger.warn("shutdownNetworkRules failed during the network " + network + "
shutdown due to ", ex);
         } finally {
@@ -2090,8 +2103,6 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         }
 
         // 2) Shutdown all the network elements
-        // get providers to shutdown
-        List<Provider> providersToShutdown = getNetworkProviders(network.getId());
         boolean success = true;
         for (NetworkElement element : networkElements) {
             if (providersToShutdown.contains(element.getProvider())) {


Mime
View raw message