Damans227 commented on code in PR #14217:
URL: https://github.com/apache/cloudstack/pull/14217#discussion_r4223211141
##########
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:
if the range is bad this throws after the network is already saved, so does
the user end up with a leftover network? could we check the range before
creating it?
##########
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:
what happens if the network is later shrunk with the guest vm cidr option?
the saved range could end up partly outside the new 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]