Skip to content

Commit 665283a

Browse files
committed
Check if associated networkId is passed when specify vlan is false
1 parent 9ea0eb0 commit 665283a

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,16 +1635,8 @@ public Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapac
16351635
throwInvalidIdException("Network offering with specified id doesn't support adding multiple ip ranges", ntwkOff.getUuid(), NETWORK_OFFERING_ID);
16361636
}
16371637

1638-
if (GuestType.Shared == ntwkOff.getGuestType()) {
1639-
if (!ntwkOff.isSpecifyIpRanges()) {
1640-
throw new CloudRuntimeException("The 'specifyipranges' parameter should be true for Shared Networks");
1641-
}
1642-
if (ipv4 && Objects.isNull(startIP)) {
1643-
throw new CloudRuntimeException("IPv4 address range needs to be provided");
1644-
}
1645-
if (ipv6 && Objects.isNull(startIPv6)) {
1646-
throw new CloudRuntimeException("IPv6 address range needs to be provided");
1647-
}
1638+
if (GuestType.Shared == ntwkOff.getGuestType() && !ntwkOff.isSpecifyVlan() && Objects.isNull(associatedNetworkId)) {
1639+
throw new CloudRuntimeException("Associated network must be provided when creating Shared networks when specifyVlan is false");
16481640
}
16491641

16501642
Pair<Integer, Integer> interfaceMTUs = validateMtuConfig(publicMtu, privateMtu, zone.getId());

0 commit comments

Comments
 (0)