Skip to content

server: Fix reservedIpAddressesAmount calculation for non-IPv4 VLANs - #14072

Closed
weizhouapache wants to merge 1 commit into
apache:mainfrom
weizhouapache:4.20-fix-create-vlan-for-ipv6
Closed

server: Fix reservedIpAddressesAmount calculation for non-IPv4 VLANs#14072
weizhouapache wants to merge 1 commit into
apache:mainfrom
weizhouapache:4.20-fix-create-vlan-for-ipv6

Conversation

@weizhouapache

Copy link
Copy Markdown
Member

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

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • 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
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

Only compute the reserved IPv4 address count when the VLAN is IPv4,
avoiding incorrect long arithmetic on start/end IP for IPv6-only VLANs.
Copilot AI lite review requested due to automatic review settings September 7, 2026 12:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 reservedIpAddressesAmount calculation behind the existing ipv4 flag before calling NetUtils.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

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 19.78%. Comparing base (2cd8c5e) to head (6537830).
⚠️ Report is 1033 commits behind head on main.

Files with missing lines Patch % Lines
.../cloud/configuration/ConfigurationManagerImpl.java 0.00% 0 Missing and 1 partial ⚠️
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     
Flag Coverage Δ
uitests 3.53% <ø> (-0.62%) ⬇️
unittests 21.05% <0.00%> (+3.84%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants