Skip to content

Add conserve mode for VPC offerings#12487

Open
nvazquez wants to merge 11 commits intoapache:mainfrom
shapeblue:423-source-nat-vpc-conserve
Open

Add conserve mode for VPC offerings#12487
nvazquez wants to merge 11 commits intoapache:mainfrom
shapeblue:423-source-nat-vpc-conserve

Conversation

@nvazquez
Copy link
Contributor

@nvazquez nvazquez commented Jan 21, 2026

Description

This PR extends the conserve mode for VPCs tiers added on the previous PRs: #8309, #10744 by allowing:

  • If the VPC tier offering uses conserve mode, then the public IP used for Source NAT can be reused for multiple services (it was previously restricted to Source NAT only)

This PR also introduces the following changes:

  • Introduce conserve mode for VPC offerings
  • When a VPC is created from a VPC offering using conserve mode: public IP rules can be created on different VPC tiers (when conserve mode = false, the rules are restricted to a single VPC tier).

Fixes: #8317

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?

  • Create a VPC Offering with Conserve mode enabled selecting:
    • Conserve mode = True
    • Services: Dns, Dhcp, Vpn, UserData, StaticNat, SourceNat, NetworkACL, Portforwarding, Lb as VpcVirtualRouter
  • Create VPC selecting the previous VPC Offering
  • Create VPC tiers with the default isolated network offering for VPC and deploy VMs on each tier
  • Observe the Source NAT IP address can be used for multiple services, create different rules
  • Acquire new Public IP address and create rules across different VPC tiers for the same Public IP address

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

@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

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

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 30.43478% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.92%. Comparing base (1b0a036) to head (1367e43).
⚠️ Report is 180 commits behind head on main.

Files with missing lines Patch % Lines
...n/java/com/cloud/network/IpAddressManagerImpl.java 0.00% 8 Missing and 2 partials ⚠️
...e/cloudstack/api/response/VpcOfferingResponse.java 0.00% 6 Missing ⚠️
...main/java/com/cloud/network/vpc/VpcOfferingVO.java 0.00% 6 Missing ⚠️
...om/cloud/network/firewall/FirewallManagerImpl.java 76.00% 1 Missing and 5 partials ⚠️
...ck/api/command/admin/vpc/CreateVPCOfferingCmd.java 0.00% 3 Missing ⚠️
...rg/apache/cloudstack/api/response/VpcResponse.java 0.00% 3 Missing ⚠️
...java/com/cloud/api/query/vo/VpcOfferingJoinVO.java 0.00% 3 Missing ⚠️
...loud/network/lb/LoadBalancingRulesManagerImpl.java 0.00% 3 Missing ⚠️
...ain/java/com/cloud/network/vpc/VpcManagerImpl.java 40.00% 2 Missing and 1 partial ⚠️
...and/user/firewall/CreatePortForwardingRuleCmd.java 0.00% 1 Missing ⚠️
... and 4 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12487      +/-   ##
============================================
+ Coverage     17.84%   17.92%   +0.08%     
- Complexity    15980    16164     +184     
============================================
  Files          5929     5939      +10     
  Lines        531084   533262    +2178     
  Branches      64914    65252     +338     
============================================
+ Hits          94783    95610     +827     
- Misses       425686   426908    +1222     
- Partials      10615    10744     +129     
Flag Coverage Δ
uitests 3.66% <ø> (+0.08%) ⬆️
unittests 19.04% <30.43%> (+0.09%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 16471

@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@nvazquez 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

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

@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@nvazquez 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

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

@nvazquez
Copy link
Contributor Author

@blueorangutan test keepEnv

@blueorangutan
Copy link

@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-15239)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 55566 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12487-t15239-kvm-ol8.zip
Smoke tests completed. 147 look OK, 3 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_03_deploy_and_scale_kubernetes_cluster Failure 26.70 test_kubernetes_clusters.py
test_02_list_cpvm_vm Failure 0.03 test_ssvm.py
test_04_cpvm_internals Failure 0.04 test_ssvm.py
test_01_redundant_vpc_site2site_vpn Failure 392.36 test_vpc_vpn.py

@nvazquez nvazquez marked this pull request as ready for review January 27, 2026 05:09
@nvazquez nvazquez added this to the 4.23.0 milestone Jan 27, 2026
@nvazquez nvazquez changed the title Fix conserve mode for VPC Source NAT IP and extend rules for VPC tiers Fix conserve mode for VPC Source NAT IP and extend conserve mode for VPC offerings Jan 27, 2026
@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

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

Copy link
Contributor

Copilot AI left a comment

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 extends “IP conserve mode” behavior into VPC offerings and relaxes certain per-tier restrictions so that, when conserve mode is enabled, a VPC’s Source NAT public IP can be reused for additional services and public-IP rules can be created across multiple VPC tiers.

Changes:

  • Add conservemode to VPC offerings end-to-end (DB schema/view/entity, API params/responses, UI create form + details).
  • Adjust backend rule/network selection and conflict checks to allow cross-tier usage in VPC conserve mode (PF/LB/firewall paths).
  • Update UI logic for Public IP / PF / LB screens to reflect conserve-mode behavior (tier selection and tab availability).

Reviewed changes

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

Show a summary per file
File Description
ui/src/views/offering/AddVpcOffering.vue Adds a Conserve Mode switch and passes conservemode to createVPCOffering.
ui/src/views/network/PublicIpResource.vue Changes tab filtering for VPC SourceNAT IPs based on VPC offering conserve mode.
ui/src/views/network/PortForwarding.vue Allows tier selection when VPC conserve mode is enabled; uses VPC offering conserve mode flag.
ui/src/views/network/LoadBalancing.vue Allows tier selection when VPC conserve mode is enabled; uses VPC offering conserve mode flag.
ui/src/config/section/offering.js Shows conservemode in VPC offering details.
server/src/main/java/com/cloud/network/firewall/FirewallManagerImpl.java Relaxes cross-network firewall-rule conflict restriction for VPC conserve mode.
server/src/test/java/com/cloud/network/firewall/FirewallManagerTest.java Updates unit test setup for new network lookup in conflict detection.
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java Threads a networkId parameter to support VPC-tier-aware LB creation.
engine/components-api/src/main/java/com/cloud/network/lb/LoadBalancingRulesManager.java Updates API surface to include networkId parameter.
server/src/main/java/com/cloud/network/IpAddressManagerImpl.java Adjusts Source NAT detection when associating IPs within VPCs.
api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java Adds conservemode parameter for VPC offering creation.
engine/schema/src/main/java/com/cloud/network/vpc/VpcOfferingVO.java Persists conserve_mode on VPC offerings.
engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql Adds conserve_mode column to vpc_offerings.
engine/schema/src/main/resources/META-INF/db/views/cloud.vpc_offering_view.sql Exposes conserve_mode via VPC offering DB view.
server/src/main/java/com/cloud/api/query/vo/VpcOfferingJoinVO.java Exposes conserve_mode on the VPC offering join view VO.
server/src/main/java/com/cloud/api/query/dao/VpcOfferingJoinDaoImpl.java Populates conserve mode in VpcOfferingResponse.
api/src/main/java/org/apache/cloudstack/api/response/VpcOfferingResponse.java Adds conservemode field to VPC offering response.
api/src/main/java/org/apache/cloudstack/api/response/VpcResponse.java Adds vpcofferingconservemode field to VPC response.
server/src/main/java/com/cloud/api/ApiResponseHelper.java Sets vpcofferingconservemode in VPC response.
api/src/main/java/org/apache/cloudstack/api/ApiConstants.java Adds vpcofferingconservemode constant.
api/src/main/java/com/cloud/network/vpc/VpcOffering.java Adds isConserveMode() to VPC offering interface.
api/src/main/java/com/cloud/network/vpc/VpcProvisioningService.java Extends createVpcOffering signature to include conserve mode.
server/src/main/java/com/cloud/network/vpc/VpcManagerImpl.java Plumbs conserve mode into VPC offering creation/persist.
api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java Adjusts network-id resolution behavior for VPC IPs.
plugins/network-elements/elastic-loadbalancer/.../LoadBalanceRuleHandler.java Updates LB manager call to include networkId.
plugins/network-elements/juniper-contrail/.../ContrailManagerImpl.java Updates VPC offering creation call signature.
Comments suppressed due to low confidence (1)

ui/src/views/network/PortForwarding.vue:649

  • The networkId selection logic for createPortForwardingRule is inverted due to parentheses: !('associatednetworkid' in this.resource || this.vpcConserveMode) becomes true only when BOTH there is no associated network AND conserve mode is false. This will incorrectly choose associatednetworkid when conserve mode is enabled (the opposite of what the UI/feature intends). Use the same condition used elsewhere in the file: no associated network OR vpcConserveMode => selectedTier; otherwise associatednetworkid.
      this.loading = true
      this.addVmModalVisible = false
      const networkId = ('vpcid' in this.resource && (!('associatednetworkid' in this.resource || this.vpcConserveMode))) ? this.selectedTier : this.resource.associatednetworkid
      postAPI('createPortForwardingRule', {
        ...this.newRule,
        ipaddressid: this.resource.id,
        networkid: networkId

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

@nvazquez nvazquez marked this pull request as ready for review February 24, 2026 22:39
@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@nvazquez 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

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

@nvazquez
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-15519)

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-15520)

@blueorangutan
Copy link

[SF] Trillian test result (tid-15521)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 49215 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12487-t15521-kvm-ol8.zip
Smoke tests completed. 146 look OK, 5 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_LoginApiDomain Error 7.10 test_accounts.py
ContextSuite context=TestListIdsParams>:teardown Error 1.12 test_list_ids_parameter.py
test_01_snapshot_root_disk Error 4.96 test_snapshots.py
test_02_list_snapshots_with_removed_data_store Error 46.63 test_snapshots.py
test_02_list_snapshots_with_removed_data_store Error 46.63 test_snapshots.py
ContextSuite context=TestSnapshotStandaloneBackup>:teardown Error 27.56 test_snapshots.py
test_01_snapshot_usage Error 19.70 test_usage.py
test_01_vpn_usage Error 1.11 test_usage.py
ContextSuite context=TestVPCConserveModeRules>:setup Error 0.00 test_vpc_conserve_mode.py

@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@nvazquez 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

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

@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@nvazquez 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

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

@nvazquez
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

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.

VPC SourceNAT IPs can't be used for services (PF, LB, etc...)

7 participants