cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From muralire...@apache.org
Subject git commit: updated refs/heads/master to 0f40cfb
Date Fri, 28 Jun 2013 06:59:40 GMT
Updated Branches:
  refs/heads/master 6da29c4cd -> 0f40cfbea


CLOUDSTACK-2045: [Multiple IPs Per Nic] This feature is not working well
in case of networks with external devices after GC

add an exception for networks that use external networking devices and has
secondary guest IP's allocated. On network GC, when network goes through
implement phase a new vlan is allocated, based on the acquired VLAN id cidr
of the network is decided in case of external networking case. While NIC
uses reservation strategy 'Start' which ensures that new primary ip is
allocated for the NiC from the new CIDR. Secondary IP's have hardcoded
IP's in  network rules. So prevent network GC.


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

Branch: refs/heads/master
Commit: 0f40cfbea8b3f1f5c7385ff8cce359fc164848d9
Parents: 6da29c4
Author: Murali Reddy <muralimmreddy@gmail.com>
Authored: Fri Jun 28 12:21:56 2013 +0530
Committer: Murali Reddy <muralimmreddy@gmail.com>
Committed: Fri Jun 28 12:26:20 2013 +0530

----------------------------------------------------------------------
 api/src/com/cloud/network/NetworkModel.java     |  2 ++
 .../com/cloud/network/NetworkManagerImpl.java   |  5 +++++
 .../src/com/cloud/network/NetworkModelImpl.java | 21 ++++++++++++++++++++
 .../com/cloud/network/MockNetworkModelImpl.java |  5 +++++
 .../com/cloud/vpc/MockNetworkModelImpl.java     |  4 ++++
 5 files changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0f40cfbe/api/src/com/cloud/network/NetworkModel.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/NetworkModel.java b/api/src/com/cloud/network/NetworkModel.java
index ea39d83..01c0e21 100644
--- a/api/src/com/cloud/network/NetworkModel.java
+++ b/api/src/com/cloud/network/NetworkModel.java
@@ -276,4 +276,6 @@ public interface NetworkModel {
     Nic getNicInNetworkIncludingRemoved(long vmId, long networkId);
 
     boolean getExecuteInSeqNtwkElmtCmd();
+
+    boolean isNetworkReadyForGc(long networkId);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0f40cfbe/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index cb3cbbf..938d9b1 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -2975,6 +2975,11 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
 
                 List<Long> networkIds = _networksDao.findNetworksToGarbageCollect();
                 for (Long networkId : networkIds) {
+
+                    if (!_networkModel.isNetworkReadyForGc(networkId)) {
+                        continue;
+                    }
+
                     Long time = _lastNetworkIdsToFree.remove(networkId);
                     if (time == null) {
                         if (s_logger.isDebugEnabled()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0f40cfbe/server/src/com/cloud/network/NetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java
index 9ab8f3f..21ef8bc 100755
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -2126,4 +2126,25 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel
{
     public boolean getExecuteInSeqNtwkElmtCmd() {
         return _executeInSequenceNtwkElmtCmd;
     }
+
+    @Override
+    public boolean isNetworkReadyForGc(long networkId) {
+        Network network = getNetwork(networkId);
+        List<Long> networkIds = _networksDao.findNetworksToGarbageCollect();
+        List<String> secondaryIps = _nicSecondaryIpDao.listSecondaryIpAddressInNetwork(networkId);
+        if (!networkIds.contains(networkId)) {
+            return false;
+        }
+
+        // add an exception for networks that use external networking devices and has secondary
guest IP's allocated.
+        // On network GC, when network goes through implement phase a new vlan is allocated,
based on the acquired VLAN
+        // id cidr of the network is decided in case of external networking case. While NIC
uses reservation strategy 'Start'
+        // which ensures that new primary ip is allocated for the NiC from the new CIDR.
Secondary IP's have hardcoded IP's in
+        // network rules. So prevent network GC.
+        if (secondaryIps != null && !secondaryIps.isEmpty() &&
+                networkIsConfiguredForExternalNetworking(network.getDataCenterId(), networkId))
{
+        }
+
+        return true;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0f40cfbe/server/test/com/cloud/network/MockNetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/MockNetworkModelImpl.java b/server/test/com/cloud/network/MockNetworkModelImpl.java
index bab9df8..92e4cb1 100644
--- a/server/test/com/cloud/network/MockNetworkModelImpl.java
+++ b/server/test/com/cloud/network/MockNetworkModelImpl.java
@@ -885,4 +885,9 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel
{
         // TODO Auto-generated method stub
         return false;
     }
+
+    @Override
+    public boolean isNetworkReadyForGc(long networkId) {
+        return true;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0f40cfbe/server/test/com/cloud/vpc/MockNetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockNetworkModelImpl.java b/server/test/com/cloud/vpc/MockNetworkModelImpl.java
index a6ab126..9fbc65a 100644
--- a/server/test/com/cloud/vpc/MockNetworkModelImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkModelImpl.java
@@ -898,4 +898,8 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel
{
         return false;
     }
 
+    @Override
+    public boolean isNetworkReadyForGc(long networkId) {
+        return true;
+    }
 }


Mime
View raw message