Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions server/src/main/java/com/cloud/network/NetworkServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -3816,12 +3816,8 @@ public PhysicalNetwork createPhysicalNetwork(final Long zoneId, final String vne
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");
}

Comment on lines 3819 to 3822
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a new method to be called in two places @weizhouapache ?

BroadcastDomainRange broadcastDomainRange = null;
Expand Down Expand Up @@ -3943,11 +3939,9 @@ public PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<
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) {
Expand Down
4 changes: 2 additions & 2 deletions server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -3630,8 +3630,8 @@ public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, Service
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);
Expand Down