server: Fix reservedIpAddressesAmount calculation for non-IPv4 VLANs - #14072
server: Fix reservedIpAddressesAmount calculation for non-IPv4 VLANs#14072weizhouapache wants to merge 1 commit into
Conversation
Only compute the reserved IPv4 address count when the VLAN is IPv4, avoiding incorrect long arithmetic on start/end IP for IPv6-only VLANs.
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, matches the stated intent, and correctly guards IPv4-only arithmetic behind the existing ipv4 condition.
Pull request overview
This PR fixes VLAN range creation for IPv6-only ranges by ensuring the reserved IPv4 address count is computed only when an IPv4 range is present, preventing invalid arithmetic on IPv6 inputs.
Changes:
- Gate
reservedIpAddressesAmountcalculation behind the existingipv4flag before callingNetUtils.ip2Long(...).
File summaries
| File | Description |
|---|---|
| server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java | Avoids computing reserved IP count via IPv4 conversion when the VLAN range is IPv6-only. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14072 +/- ##
============================================
+ Coverage 16.34% 19.78% +3.43%
- Complexity 13574 19991 +6417
============================================
Files 5669 6371 +702
Lines 501368 575903 +74535
Branches 60903 70496 +9593
============================================
+ Hits 81964 113938 +31974
- Misses 410219 449536 +39317
- Partials 9185 12429 +3244
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:
|
Description
This PR fixes the issue when creating vlan range for IPv6
Only compute the reserved IPv4 address count when the VLAN is IPv4, avoiding incorrect long arithmetic on start/end IP for IPv6-only VLANs.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?