incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject [5/50] [abbrv] git commit: Summary: Allow for same vlan num on different physical NICs
Date Mon, 28 Jan 2013 12:22:52 GMT
Summary: Allow for same vlan num on different physical NICs

Detail: A previous bug in the database schema did not allow the same vlan num
to exist on separate physical networks, even though this is possible and should
be allowed. To fix this, the code was changed to also disallow the same vlan
num on different physical networks, to avoid hitting the database constraint.
The database constraint has now been changed to allow only one of a vlan num
per physical nic per data center, so different physical nics can reuse vlan
numbers. This fix adjusts the code to match by removing the old fix.

BUG-ID: CLOUDSTACK-686
Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1358881555 -0700


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

Branch: refs/heads/regions
Commit: 2e14cf5b5772a6c19d3da0dfae71804200a76abe
Parents: 22e70f2
Author: Marcus Sorensen <marcus@betterservers.com>
Authored: Tue Jan 22 12:05:55 2013 -0700
Committer: Marcus Sorensen <marcus@betterservers.com>
Committed: Tue Jan 22 12:05:55 2013 -0700

----------------------------------------------------------------------
 .../src/com/cloud/network/NetworkServiceImpl.java  |   24 ---------------
 1 files changed, 0 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2e14cf5b/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index b05aece..7530e94 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -1814,9 +1814,6 @@ public class NetworkServiceImpl implements  NetworkService, Manager
{
                 throw new InvalidParameterValueException("Please specify valid integers for
the vlan range.");
             }
             
-            //check for vnet conflicts with other physical network(s) in the zone
-            checkGuestVnetsConflicts(zoneId, vnetStart, vnetEnd, null);
-
             if ((vnetStart > vnetEnd) || (vnetStart < 0) || (vnetEnd > 4096)) {
                 s_logger.warn("Invalid vnet range: start range:" + vnetStart + " end range:"
+ vnetEnd);
                 throw new InvalidParameterValueException("Vnet range should be between 0-4096
and start range should be lesser than or equal to end range");
@@ -1995,9 +1992,6 @@ public class NetworkServiceImpl implements  NetworkService, Manager
{
                 throw new InvalidParameterValueException("Vnet range has to be" + rangeMessage
+ " and start range should be lesser than or equal to stop range");
             }
             
-            //check if new vnet conflicts with vnet ranges of other physical networks
-            checkGuestVnetsConflicts(network.getDataCenterId(), newStartVnet, newEndVnet,
network.getId());
-
             if (physicalNetworkHasAllocatedVnets(network.getDataCenterId(), network.getId()))
{
                 String[] existingRange = network.getVnet().split("-");
                 int existingStartVnet = Integer.parseInt(existingRange[0]);
@@ -2042,24 +2036,6 @@ public class NetworkServiceImpl implements  NetworkService, Manager
{
         return network;
     }
 
-    protected void checkGuestVnetsConflicts(long zoneId, int newStartVnet, int newEndVnet,
Long pNtwkIdToSkip) {
-        List<? extends PhysicalNetwork> pNtwks = _physicalNetworkDao.listByZone(zoneId);
-        for (PhysicalNetwork pNtwk : pNtwks) {
-            // skip my own network and networks that don't have vnet range set
-            if ((pNtwk.getVnet() == null || pNtwk.getVnet().isEmpty()) || (pNtwkIdToSkip
!= null && pNtwkIdToSkip == pNtwk.getId())) {
-                continue;
-            }
-            String[] existingRange = pNtwk.getVnet().split("-");
-            int startVnet = Integer.parseInt(existingRange[0]);
-            int endVnet = Integer.parseInt(existingRange[1]);
-            if ((newStartVnet >= startVnet && newStartVnet <= endVnet)
-                    || (newEndVnet <= endVnet && newEndVnet >= startVnet))
{
-                throw new InvalidParameterValueException("Vnet range for physical network
conflicts with another " +
-                		"physical network's vnet in the zone");
-            } 
-        }
-    }
-
     private boolean physicalNetworkHasAllocatedVnets(long zoneId, long physicalNetworkId)
{
         return !_dcDao.listAllocatedVnets(physicalNetworkId).isEmpty();
     }


Mime
View raw message