rootnomad commented on code in PR #14217:
URL: https://github.com/apache/cloudstack/pull/14217#discussion_r4231757211
##########
server/src/main/java/com/cloud/network/NetworkServiceImpl.java:
##########
@@ -1838,6 +1838,12 @@ public Network createGuestNetwork(CreateNetworkCmd cmd)
throws InsufficientCapac
domainId, isDomainSpecific, subdomainAccess, vpcId, startIPv6,
endIPv6, ip6Gateway, ip6Cidr, displayNetwork, aclId, secondaryVlanId,
privateVlanType, ntwkOff, pNtwk, aclType, owner, cidr, createVlan,
externalId, routerIPv4, routerIPv6, associatedNetwork,
ip4Dns1, ip4Dns2, ip6Dns1, ip6Dns2, interfaceMTUs, networkCidrSize,
keepMacAddressOnPublicNic);
+ // For an isolated network a start/end IP defines a custom DHCP range
within the CIDR that
+ // guest IPs are allocated from; without it the whole CIDR is used,
which is the default.
+ if (ntwkOff.getGuestType() == GuestType.Isolated &&
StringUtils.isNotBlank(startIP)) {
+ storeIsolatedNetworkDhcpRange(network.getId(), startIP, endIP);
Review Comment:
Fixed in 1bade4bc92. The range is now validated before commitNetwork via
validateIsolatedNetworkDhcpRange, so a range outside the CIDR (or reversed, or
over the gateway) is rejected up front and nothing is persisted, no orphaned
network. Added a unit test for the validator.
##########
server/src/main/java/com/cloud/network/NetworkModelImpl.java:
##########
@@ -2333,6 +2333,12 @@ public Set<Long> getAvailableIps(Network network, String
requestedIp) {
if ((gateway != null) &&
(allPossibleIps.contains(NetUtils.ip2Long(gateway))))
allPossibleIps.remove(NetUtils.ip2Long(gateway));
+ if (StringUtils.isNoneBlank(network.getDhcpStartIp(),
network.getDhcpEndIp())) {
+ long start = NetUtils.ip2Long(network.getDhcpStartIp());
+ long end = NetUtils.ip2Long(network.getDhcpEndIp());
+ allPossibleIps.removeIf(ip -> ip < start || ip > end);
Review Comment:
Fixed in 1bade4bc92. The updateNetwork guestVmCidr path now rejects a
reservation that would leave the stored DHCP range outside the new Guest VM
CIDR, with a message to remove or adjust the range first, so the saved range
can no longer end up partly outside the CIDR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]