Skip to content

Commit 524fff4

Browse files
committed
Add checks if IP range is passed if Shared Network
1 parent afc95f1 commit 524fff4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,6 +1634,18 @@ public Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapac
16341634
throwInvalidIdException("Network offering with specified id doesn't support adding multiple ip ranges", ntwkOff.getUuid(), NETWORK_OFFERING_ID);
16351635
}
16361636

1637+
if (GuestType.Shared == ntwkOff.getGuestType()) {
1638+
if (!ntwkOff.isSpecifyIpRanges()) {
1639+
throw new CloudRuntimeException("Specify IP Ranged should be true for Shared Networks");
1640+
}
1641+
if (ipv4 && Objects.isNull(startIP)) {
1642+
throw new CloudRuntimeException("IPv4 address range needs to be provided");
1643+
}
1644+
if (ipv6 && Objects.isNull(startIPv6)) {
1645+
throw new CloudRuntimeException("IPv6 address range needs to be provided");
1646+
}
1647+
}
1648+
16371649
Pair<Integer, Integer> interfaceMTUs = validateMtuConfig(publicMtu, privateMtu, zone.getId());
16381650
mtuCheckForVpcNetwork(vpcId, interfaceMTUs, publicMtu, privateMtu);
16391651

0 commit comments

Comments
 (0)