server: null-check requested IP in assignSourceNatPublicIpAddress - #14025
nagaboinaramgopal wants to merge 1 commit into
Conversation
assignSourceNatPublicIpAddress looked up the requested IP with _ipAddressDao.findByIpAndDcId() and immediately checked ipAddressVO.getState(). findByIpAndDcId returns null when the requested IP is not a known public IP in the zone, so an invalid or unknown requestedIp produced a NullPointerException instead of a meaningful capacity error. Treat a null lookup result like a non-free address and throw InsufficientAddressCapacityException. Adds a regression test with an unknown requested IP (NullPointerException before the fix).
28f0c62 to
87d961b
Compare
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.20 #14025 +/- ##
============================================
+ Coverage 16.34% 19.78% +3.44%
- Complexity 13574 19997 +6423
============================================
Files 5669 6371 +702
Lines 501368 575899 +74531
Branches 60903 70495 +9592
============================================
+ Hits 81964 113962 +31998
- Misses 410219 449508 +39289
- 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:
|
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19092 |
|
@blueorangutan test |
|
@vishesh92 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian Build Failed (tid-16945) |
|
Thank you @DaanHoogland and @vishesh92 for the reviews. I noticed the smoke test run on 09-09 ended with a Trillian build failure (tid-16945). Whenever a slot is free, would it be possible to run it again? Thank you. |
|
@blueorangutan package |
|
@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19259 |
|
@blueorangutan test |
|
@vishesh92 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-16993)
|
Description
assignSourceNatPublicIpAddresslooks up the requested IP withfindByIpAndDcIdand then reads its state:findByIpAndDcIdreturns null when the requested IP is not a known public IP inthe zone, so this throws a NullPointerException instead of a meaningful error.
Fixed by null-checking the result first, so the method throws the intended
InsufficientAddressCapacityExceptionwhen the IP cannot be found.Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
Added a unit test that requests a source NAT IP not present in the zone and
asserts an InsufficientAddressCapacityException is thrown instead of an NPE.
Also built the standard packages and deployed on a KVM advanced zone.