rootnomad commented on code in PR #14217:
URL: https://github.com/apache/cloudstack/pull/14217#discussion_r4772466729
##########
server/src/main/java/com/cloud/network/NetworkServiceImpl.java:
##########
@@ -4271,6 +4310,17 @@ public Network updateGuestNetwork(final UpdateNetworkCmd
cmd) {
}
}
+ // A custom DHCP range must stay within the reserved Guest VM
CIDR; reject a reservation that would
+ // leave the stored range partly or wholly outside it, otherwise
guest IP allocation could be starved.
+ if (StringUtils.isNoneBlank(network.getDhcpStartIp(),
network.getDhcpEndIp())) {
+ long dhcpStart = NetUtils.ip2Long(network.getDhcpStartIp());
+ long dhcpEnd = NetUtils.ip2Long(network.getDhcpEndIp());
+ if (dhcpStart < startIp || dhcpEnd > endIp) {
+ throw new
InvalidParameterValueException(String.format("The network has a custom DHCP
range %s-%s that falls outside the requested Guest VM CIDR %s. Remove or adjust
the DHCP range before applying the reservation.",
+ network.getDhcpStartIp(), network.getDhcpEndIp(),
guestVmCidr));
+ }
+ }
Review Comment:
Done in 18529bda354.
--
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]