Skip to content

network: handle missing network when releasing public IP - #14133

Open
xujiantop-crypto wants to merge 2 commits into
apache:4.22from
xujiantop-crypto:fix/vpc-destroy-null-network-422
Open

network: handle missing network when releasing public IP#14133
xujiantop-crypto wants to merge 2 commits into
apache:4.22from
xujiantop-crypto:fix/vpc-destroy-null-network-422

Conversation

@xujiantop-crypto

@xujiantop-crypto xujiantop-crypto commented Sep 10, 2026

Copy link
Copy Markdown

Fixes #14068

During VPC teardown, a public IP can retain its associated network ID after the tier's network record has been deleted. disassociatePublicIpAddress passes the missing network to applyIpAssociations, which dereferences it and aborts VPC deletion with a NullPointerException.

Resolve the associated network before choosing the release path. When the network no longer exists, a releasing IP follows the existing quarantine and unassignment path. The association path continues to be used when the network exists.

The regression test supplies a non-null associated network ID whose DAO lookup returns null while the VPC still exists. It verifies successful release, quarantine, IP unassignment, VPC provider cleanup, annotation cleanup and lock release, without calling applyIpAssociations. Additional tests cover successful and failed associations when the network exists, and prevent repeated quarantine/unassignment of an already free IP when the network is missing.

This targets 4.22 in accordance with the contribution guide's release-branch policy for bug fixes; the affected code is also present there.

Validation

  • The initial missing-network regression test reproduced NullPointerException on the unfixed 4.22 base.
  • With the fix and expanded coverage, the complete IpAddressManagerTest passes: 30 tests, 0 failures/errors/skips. All 25 selected reactor modules succeed, with 0 Checkstyle violations (JDK 11).
  • git diff --check passes.

The Maven download plugin could not retrieve the system VM checksum file in this environment. I downloaded the unmodified official https://download.cloudstack.org/systemvm/4.22/sha512sum.txt to engine/schema/dist/systemvm-templates/sha512sum.txt and ran:

mvn -B -pl server -am -Dtest=IpAddressManagerTest -Dsurefire.failIfNoSpecifiedTests=false -Ddownload.plugin.skip=true test

Only the redundant download was skipped; compilation, Checkstyle and the selected tests ran. No build configuration changes are included.

For an environment-level check, follow the steps in #14068: create a VPC offering with firewall service enabled, deploy a tier and VM, apply a public-IP firewall rule, remove the VM and tier, then destroy the VPC. The VPC should be removed without the missing-network exception and the public IP should be released. This full VPC scenario has not been run locally.

Signed-off-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
Signed-off-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 17.94%. Comparing base (b9a5977) to head (8903273).

Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #14133   +/-   ##
=========================================
  Coverage     17.94%   17.94%           
- Complexity    16145    16151    +6     
=========================================
  Files          5928     5928           
  Lines        535174   535176    +2     
  Branches      65494    65495    +1     
=========================================
+ Hits          96017    96057   +40     
+ Misses       428228   428181   -47     
- Partials      10929    10938    +9     
Flag Coverage Δ
uitests 4.02% <ø> (ø)
unittests 19.02% <100.00%> (+<0.01%) ⬆️

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant