Skip to content

Commit 9c78d22

Browse files
committed
remove condition for associated network when !specifyvlan in shared network
revert part of #10168
1 parent 99ea77d commit 9c78d22

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,10 +1635,19 @@ 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() && !ntwkOff.isSpecifyVlan() && Objects.isNull(associatedNetworkId)) {
1639-
throw new CloudRuntimeException("Associated network must be provided when creating Shared networks when specifyVlan is false");
1640-
}
16411638

1639+
1640+
if (GuestType.Shared == ntwkOff.getGuestType()) {
1641+
if (!ntwkOff.isSpecifyIpRanges()) {
1642+
throw new CloudRuntimeException("The 'specifyipranges' parameter should be true for Shared Networks");
1643+
}
1644+
if (ipv4 && Objects.isNull(startIP)) {
1645+
throw new CloudRuntimeException("IPv4 address range needs to be provided");
1646+
}
1647+
if (ipv6 && Objects.isNull(startIPv6)) {
1648+
throw new CloudRuntimeException("IPv6 address range needs to be provided");
1649+
}
1650+
}
16421651
Pair<Integer, Integer> interfaceMTUs = validateMtuConfig(publicMtu, privateMtu, zone.getId());
16431652
mtuCheckForVpcNetwork(vpcId, interfaceMTUs, publicMtu);
16441653

0 commit comments

Comments
 (0)