server: dedicate vxlan range to account (#7215)

This fixes #6871
This commit is contained in:
Wei Zhou 2023-04-19 08:44:53 +02:00 committed by GitHub
parent 96897f07f2
commit fb51504dff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -4048,12 +4048,14 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
}
vlanOwnerId = vlanOwner.getAccountId();
// Verify physical network isolation type is VLAN
// Verify physical network isolation methods contain VLAN or VXLAN
PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
if (physicalNetwork == null) {
throw new InvalidParameterValueException("Unable to find physical network by id " + physicalNetworkId);
} else if (!physicalNetwork.getIsolationMethods().isEmpty() && !physicalNetwork.getIsolationMethods().contains("VLAN")) {
throw new InvalidParameterValueException("Cannot dedicate guest vlan range. " + "Physical isolation type of network " + physicalNetworkId + " is not VLAN");
} else if (!physicalNetwork.getIsolationMethods().isEmpty() &&
!physicalNetwork.getIsolationMethods().contains("VLAN") &&
!physicalNetwork.getIsolationMethods().contains("VXLAN")) {
throw new InvalidParameterValueException("Cannot dedicate guest vlan range. " + "Physical isolation type of network " + physicalNetworkId + " is not VLAN nor VXLAN");
}
// Get the start and end vlan