Skip to content

Commit 2e14cf5

Browse files
author
Marcus Sorensen
committed
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
1 parent 22e70f2 commit 2e14cf5

1 file changed

Lines changed: 0 additions & 24 deletions

File tree

‎server/src/com/cloud/network/NetworkServiceImpl.java‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,9 +1814,6 @@ public PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, Stri
18141814
throw new InvalidParameterValueException("Please specify valid integers for the vlan range.");
18151815
}
18161816

1817-
//check for vnet conflicts with other physical network(s) in the zone
1818-
checkGuestVnetsConflicts(zoneId, vnetStart, vnetEnd, null);
1819-
18201817
if ((vnetStart > vnetEnd) || (vnetStart < 0) || (vnetEnd > 4096)) {
18211818
s_logger.warn("Invalid vnet range: start range:" + vnetStart + " end range:" + vnetEnd);
18221819
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 PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<
19951992
throw new InvalidParameterValueException("Vnet range has to be" + rangeMessage + " and start range should be lesser than or equal to stop range");
19961993
}
19971994

1998-
//check if new vnet conflicts with vnet ranges of other physical networks
1999-
checkGuestVnetsConflicts(network.getDataCenterId(), newStartVnet, newEndVnet, network.getId());
2000-
20011995
if (physicalNetworkHasAllocatedVnets(network.getDataCenterId(), network.getId())) {
20021996
String[] existingRange = network.getVnet().split("-");
20031997
int existingStartVnet = Integer.parseInt(existingRange[0]);
@@ -2042,24 +2036,6 @@ public PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<
20422036
return network;
20432037
}
20442038

2045-
protected void checkGuestVnetsConflicts(long zoneId, int newStartVnet, int newEndVnet, Long pNtwkIdToSkip) {
2046-
List<? extends PhysicalNetwork> pNtwks = _physicalNetworkDao.listByZone(zoneId);
2047-
for (PhysicalNetwork pNtwk : pNtwks) {
2048-
// skip my own network and networks that don't have vnet range set
2049-
if ((pNtwk.getVnet() == null || pNtwk.getVnet().isEmpty()) || (pNtwkIdToSkip != null && pNtwkIdToSkip == pNtwk.getId())) {
2050-
continue;
2051-
}
2052-
String[] existingRange = pNtwk.getVnet().split("-");
2053-
int startVnet = Integer.parseInt(existingRange[0]);
2054-
int endVnet = Integer.parseInt(existingRange[1]);
2055-
if ((newStartVnet >= startVnet && newStartVnet <= endVnet)
2056-
|| (newEndVnet <= endVnet && newEndVnet >= startVnet)) {
2057-
throw new InvalidParameterValueException("Vnet range for physical network conflicts with another " +
2058-
"physical network's vnet in the zone");
2059-
}
2060-
}
2061-
}
2062-
20632039
private boolean physicalNetworkHasAllocatedVnets(long zoneId, long physicalNetworkId) {
20642040
return !_dcDao.listAllocatedVnets(physicalNetworkId).isEmpty();
20652041
}

0 commit comments

Comments
 (0)