Skip to content

server: fix clone network offerings with detail internetProtocol=IPv4#13615

Draft
weizhouapache wants to merge 2 commits into
apache:mainfrom
weizhouapache:4.23-fix-clone-network-offering
Draft

server: fix clone network offerings with detail internetProtocol=IPv4#13615
weizhouapache wants to merge 2 commits into
apache:mainfrom
weizhouapache:4.23-fix-clone-network-offering

Conversation

@weizhouapache

Copy link
Copy Markdown
Member

Description

This PR fixes #13610

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?

Copilot AI review requested due to automatic review settings July 14, 2026 14:17
@weizhouapache weizhouapache added this to the 4.23.0 milestone Jul 14, 2026
@weizhouapache

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

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.

Pull request overview

This PR fixes cloning of network offerings when the source offering contains details like internetProtocol=IPv4, which previously could trigger a ClassCastException in NetworkOfferingBaseCmd.getDetails() due to an unexpected details-map structure during clone.

Changes:

  • Stop injecting source offering details into the API details parameter structure during clone; instead, carry them via a dedicated internal sourceDetailsMap.
  • Update NetworkOfferingBaseCmd.getDetails() to fall back to sourceDetailsMap when no API details were provided.
  • Exclude internetProtocol, domainid, and zoneid from the cloned details map (these are handled via dedicated command fields / parameters).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java Adjusts clone parameter population to avoid mis-shaping details and filters out special-case detail keys.
api/src/main/java/org/apache/cloudstack/api/command/admin/network/NetworkOfferingBaseCmd.java Adds an internal fallback details map and changes getDetails() to return it when API details are absent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java Outdated
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.64%. Comparing base (028e1ef) to head (297185e).

Files with missing lines Patch % Lines
.../cloud/configuration/ConfigurationManagerImpl.java 25.00% 3 Missing ⚠️
.../command/admin/network/NetworkOfferingBaseCmd.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              main   #13615       +/-   ##
============================================
+ Coverage     3.41%   19.64%   +16.23%     
- Complexity       0    19793    +19793     
============================================
  Files          487     6368     +5881     
  Lines        41860   575102   +533242     
  Branches      7910    70371    +62461     
============================================
+ Hits          1429   113006   +111577     
- Misses       40232   449815   +409583     
- Partials       199    12281    +12082     
Flag Coverage Δ
uitests 3.41% <ø> (ø)
unittests 20.92% <20.00%> (?)

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.

@Pearl1594 Pearl1594 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.

code lgtm

Copilot AI review requested due to automatic review settings July 14, 2026 14:43
@weizhouapache

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment on lines 433 to 436
public Map<String, String> getDetails() {
if (details == null || details.isEmpty()) {
return null;
return sourceDetailsMap;
}
@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18569

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18571

weizhouapache and others added 2 commits July 14, 2026 17:54
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 14, 2026 15:54
@weizhouapache weizhouapache force-pushed the 4.23-fix-clone-network-offering branch from dbdf6a8 to 297185e Compare July 14, 2026 15:54

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment on lines 433 to 436
public Map<String, String> getDetails() {
if (details == null || details.isEmpty()) {
return null;
return sourceDetailsMap;
}

@kiranchavala kiranchavala left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Tested manually

Able to clone the network offering and vpc offerings

@weizhouapache

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18580

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to clone a network offering

5 participants