Repository navigation
Conversation
A network with its own IP ranges (shared, or isolated with SpecifyIpRanges) allocates guest IPs only from those ranges. When they are all in use the allocation failed with a bare "Insufficient address capacity" scoped to the zone, which reads as the zone running out of public IPs. Say which network ran out, or that the requested IP is not available in it. The scope stays on the zone so the deployment retry logic is unchanged.
The resource reservation wrapper in deployVirtualMachine caught every exception other than ResourceAllocationException and CloudRuntimeException, logged it at ERROR with a stack trace and rethrew it as a CloudRuntimeException. An InsufficientCapacityException from NIC allocation therefore reached the API as an internal error with the raw exception text. Let it through so DeployVMCmd returns INSUFFICIENT_CAPACITY_ERROR with the exception message.
…ranges Cover GuestNetworkGuru.allocate() for isolated and shared networks with SpecifyIpRanges: both take the address from the network's IP ranges through allocateDirectIp, not from the whole CIDR.
2 of 14 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14958 +/- ##
============================================
+ Coverage 3.87% 21.17% +17.30%
- Complexity 0 21577 +21577
============================================
Files 499 6080 +5581
Lines 43120 551780 +508660
Branches 8198 73936 +65738
============================================
+ Hits 1670 116847 +115177
- Misses 41215 421140 +379925
- Partials 235 13793 +13558
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
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:
After:
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.