rootnomad opened a new pull request, #14958:
URL: https://github.com/apache/cloudstack/pull/14958
### Description
A network with its own IP ranges (shared, or isolated with SpecifyIpRanges)
gives guest VMs IPs only from those ranges. When the ranges were full,
deploying a VM failed as an internal error (530) with just "Insufficient
address capacity", scoped to the zone, and the management server logged a stack
trace at ERROR. That reads like the zone ran out of public IPs, which is what
#12772 ran into.
This names the network in that error, or the requested IP when a specific
one was asked for and is already taken. It also lets the capacity exception
through the resource reservation wrapper in deploy, so the API returns
INSUFFICIENT_CAPACITY_ERROR (533) with that message instead of an internal
error. The exception scope stays on the zone, so the deployment retry logic is
unchanged.
#14087 tried to fix this by making isolated networks with SpecifyIpRanges
allocate from the whole CIDR. As @Damans227 pointed out there, that ignores the
start and end IP set on the network. This keeps allocation on the network's IP
ranges, with a test for it, and fixes the error instead.
Fixes: #12772
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
- [ ] Build/CI
- [ ] Test (unit or integration test code)
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [ ] Minor
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [x] Minor
- [ ] Trivial
### Screenshots (if appropriate):
N/A
### How Has This Been Tested?
Unit tests for the new messages and for GuestNetworkGuru.allocate() on
isolated and shared networks with SpecifyIpRanges. The isolated allocate test
fails with the change from #14087 (allocateDirectIp is never called) and passes
here.
Live on a KVM advanced zone with a management server and 2 hosts: an
isolated network with SpecifyIpRanges and a 3 address range, and a shared
network with a 2 address range. Filled each range with VMs, then deployed one
more, and deployed one asking for an IP that was already taken. In both runs
the VMs only got IPs from the network ranges.
Before:
isolated, range full 530 Insufficient address capacity
shared, range full 530 Insufficient address capacity
requested IP in use 530 Insufficient address capacity
an ERROR stack trace "error during resource reservation and allocation"
for each
After:
isolated, range full 533 Insufficient address capacity: no free IP
address left in the IP ranges of network specifyip-iso-net
shared, range full 533 Insufficient address capacity: no free IP
address left in the IP ranges of network specifyip-shared-net
requested IP in use 533 Insufficient address capacity: the
requested IP address <ip> is not available in the IP ranges of network
specifyip-iso-net
no ERROR stack traces
#### How did you try to break this feature and the system with this change?
Checked the other callers that create VMs through the same path (autoscale,
Kubernetes clusters, Veeam restore). They already catch
InsufficientCapacityException next to CloudRuntimeException, so their handling
does not change. Public IP and system VM allocation keep the old message.
--
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]