Advanced SG: allow create/update physical networks with vlan range (#8122)

This commit is contained in:
Wei Zhou 2023-11-08 13:39:08 +01:00 committed by GitHub
parent b2e83271f8
commit 11b5831d72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 13 deletions

View File

@ -3816,12 +3816,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
throw new InvalidParameterException("Only one isolationMethod can be specified for a physical network at this time");
}
if (vnetRange != null) {
// Verify zone type
if (zoneType == NetworkType.Basic || (zoneType == NetworkType.Advanced && zone.isSecurityGroupEnabled())) {
throw new InvalidParameterValueException(
"Can't add vnet range to the physical network in the zone that supports " + zoneType + " network, Security Group enabled: " + zone.isSecurityGroupEnabled());
}
if (vnetRange != null && zoneType == NetworkType.Basic) {
throw new InvalidParameterValueException("Can't add vnet range to the physical network in the Basic zone");
}
BroadcastDomainRange broadcastDomainRange = null;
@ -3943,11 +3939,9 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
if (zone == null) {
throwInvalidIdException("Zone with id=" + network.getDataCenterId() + " doesn't exist in the system", String.valueOf(network.getDataCenterId()), "dataCenterId");
}
if (newVnetRange != null) {
if (zone.getNetworkType() == NetworkType.Basic || (zone.getNetworkType() == NetworkType.Advanced && zone.isSecurityGroupEnabled())) {
throw new InvalidParameterValueException(
"Can't add vnet range to the physical network in the zone that supports " + zone.getNetworkType() + " network, Security Group enabled: " + zone.isSecurityGroupEnabled());
}
if (newVnetRange != null && zone.getNetworkType() == NetworkType.Basic) {
throw new InvalidParameterValueException("Can't add vnet range to the physical network in the Basic zone");
}
if (tags != null && tags.size() > 1) {

View File

@ -3644,8 +3644,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
isSecurityGroupEnabledNetworkUsed = true;
}
if (!(network.getTrafficType() == TrafficType.Guest && network.getGuestType() == Network.GuestType.Shared)) {
throw new InvalidParameterValueException("Can specify only Shared Guest networks when" + " deploy vm in Advance Security Group enabled zone");
if (network.getTrafficType() != TrafficType.Guest || !Arrays.asList(GuestType.Shared, GuestType.L2).contains(network.getGuestType())) {
throw new InvalidParameterValueException("Can specify only Shared or L2 Guest networks when deploy vm in Advance Security Group enabled zone");
}
_accountMgr.checkAccess(owner, AccessType.UseEntry, false, network);