From 724be3f5f79253a98628929e4e74412a2e76a383 Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Mon, 1 Jul 2013 16:08:37 -0700 Subject: [PATCH] CLOUDSTACK-2984: createNetwork call - when vlan is specified, check that its not coming from the physical network vnet range as this range is used for dynamic vlan allocation during the network implementation stage --- .../com/cloud/configuration/ConfigurationManagerImpl.java | 4 ++-- server/src/com/cloud/network/NetworkManagerImpl.java | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 2089f82dfe9..8d8b12680ba 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -3120,10 +3120,10 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati } } - // Check if a guest VLAN is using the same tag + // Check if the vlan is being used if (_zoneDao.findVnet(zoneId, physicalNetworkId, vlanId).size() > 0) { throw new InvalidParameterValueException("The VLAN tag " + vlanId - + " is already being used for the guest network in zone " + zone.getName()); + + " is already being used for dynamic vlan allocation for the guest network in zone " + zone.getName()); } String ipRange = null; diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 938d9b1e646..dac6a3a42e7 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -2467,7 +2467,13 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L } } - if (vlanId != null) { + if (vlanSpecified) { + //don't allow to specify vlan tag used by physical network for dynamic vlan allocation + if (_dcDao.findVnet(zoneId, pNtwk.getId(), vlanId).size() > 0) { + throw new InvalidParameterValueException("The VLAN tag " + vlanId + + " is already being used for dynamic vlan allocation for the guest network in zone " + zone.getName()); + } + String uri = "vlan://" + vlanId; // For Isolated networks, don't allow to create network with vlan that already exists in the zone if (ntwkOff.getGuestType() == GuestType.Isolated) {