Skip to content

Commit 11b5831

Browse files
Advanced SG: allow create/update physical networks with vlan range (#8122)
1 parent b2e8327 commit 11b5831

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3816,12 +3816,8 @@ public PhysicalNetwork createPhysicalNetwork(final Long zoneId, final String vne
38163816
throw new InvalidParameterException("Only one isolationMethod can be specified for a physical network at this time");
38173817
}
38183818

3819-
if (vnetRange != null) {
3820-
// Verify zone type
3821-
if (zoneType == NetworkType.Basic || (zoneType == NetworkType.Advanced && zone.isSecurityGroupEnabled())) {
3822-
throw new InvalidParameterValueException(
3823-
"Can't add vnet range to the physical network in the zone that supports " + zoneType + " network, Security Group enabled: " + zone.isSecurityGroupEnabled());
3824-
}
3819+
if (vnetRange != null && zoneType == NetworkType.Basic) {
3820+
throw new InvalidParameterValueException("Can't add vnet range to the physical network in the Basic zone");
38253821
}
38263822

38273823
BroadcastDomainRange broadcastDomainRange = null;
@@ -3943,11 +3939,9 @@ public PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<
39433939
if (zone == null) {
39443940
throwInvalidIdException("Zone with id=" + network.getDataCenterId() + " doesn't exist in the system", String.valueOf(network.getDataCenterId()), "dataCenterId");
39453941
}
3946-
if (newVnetRange != null) {
3947-
if (zone.getNetworkType() == NetworkType.Basic || (zone.getNetworkType() == NetworkType.Advanced && zone.isSecurityGroupEnabled())) {
3948-
throw new InvalidParameterValueException(
3949-
"Can't add vnet range to the physical network in the zone that supports " + zone.getNetworkType() + " network, Security Group enabled: " + zone.isSecurityGroupEnabled());
3950-
}
3942+
3943+
if (newVnetRange != null && zone.getNetworkType() == NetworkType.Basic) {
3944+
throw new InvalidParameterValueException("Can't add vnet range to the physical network in the Basic zone");
39513945
}
39523946

39533947
if (tags != null && tags.size() > 1) {

server/src/main/java/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3644,8 +3644,8 @@ public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, Service
36443644
isSecurityGroupEnabledNetworkUsed = true;
36453645
}
36463646

3647-
if (!(network.getTrafficType() == TrafficType.Guest && network.getGuestType() == Network.GuestType.Shared)) {
3648-
throw new InvalidParameterValueException("Can specify only Shared Guest networks when" + " deploy vm in Advance Security Group enabled zone");
3647+
if (network.getTrafficType() != TrafficType.Guest || !Arrays.asList(GuestType.Shared, GuestType.L2).contains(network.getGuestType())) {
3648+
throw new InvalidParameterValueException("Can specify only Shared or L2 Guest networks when deploy vm in Advance Security Group enabled zone");
36493649
}
36503650

36513651
_accountMgr.checkAccess(owner, AccessType.UseEntry, false, network);

0 commit comments

Comments
 (0)