Skip to content

Flexibilize public IP selection #11076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

erikbocks
Copy link
Contributor

Description

Currently, when a public IP allocation request is made, the quarantined_ips table is ignored during the selection process. Instead, the system selects an IP without checking its quarantine status, and only validates if the IP is quarantined afterward, throwing an exception if it is.

This causes repeated failures for automatic IP selections, as the same IP will be chosen over and over, until the quarantine period ends.

This PR fixes this behaviour by considering the quarantined_ips table during the selection process, and choosing only an allocatable IP. It also brings a minor improvement to the IP quarantine logic, where IPs that were not removed either in active quarantine, were not set removed when allocated.

Now, when these IPs are allocated, the removed column is updated and the removal reason is set to: IP was removed from quarantine because it was no longer in quarantine. The PR also does a little code refactor, improving its legibility and dropping the usage of deprecated methods.

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)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

How Has This Been Tested?

I made the following tests:

Test case Result Expected? (Y/N)
1 Allocate an IP to a VR IP was allocated successfully Y
2 Allocate an IP to a System VM IP was allocated successfully Y
3 Allocate a specific IP to a VR IP was allocated successfully Y
4 Allocate an IP to a VR, but, all the IPs are already allocated Exception was thrown displaying insufficient address capacity Y
5 Allocate a specific quarantined IP, but, its quarantine is due. IP was allocated successfully Y
6 Allocate a specific quarantined IP, but, it is in active quarantine. Exception was thrown displaying insufficient address capacity. Y
7 Allocate a specific quarantined IP, but, the caller is the previous owner IP was allocated successfully Y
8 Allocated a specific quarantined IP, but, the previous owner is different than the caller Exception was thrown displaying insufficient address capacity. Y

Copy link

codecov bot commented Jun 23, 2025

Codecov Report

Attention: Patch coverage is 10.00000% with 54 lines in your changes missing coverage. Please review.

Project coverage is 16.57%. Comparing base (7632814) to head (707c02b).
Report is 58 commits behind head on main.

Files with missing lines Patch % Lines
...n/java/com/cloud/network/IpAddressManagerImpl.java 13.63% 38 Missing ⚠️
...m/cloud/network/dao/PublicIpQuarantineDaoImpl.java 0.00% 16 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##               main   #11076     +/-   ##
===========================================
  Coverage     16.57%   16.57%             
- Complexity    13868    13987    +119     
===========================================
  Files          5719     5745     +26     
  Lines        507178   510872   +3694     
  Branches      61571    62141    +570     
===========================================
+ Hits          84085    84698    +613     
- Misses       413674   416699   +3025     
- Partials       9419     9475     +56     
Flag Coverage Δ
uitests 3.91% <ø> (-0.06%) ⬇️
unittests 17.47% <10.00%> (+0.02%) ⬆️

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.

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

@DaanHoogland
Copy link
Contributor

@blueorangutan LLtest

@blueorangutan
Copy link

@DaanHoogland a [LL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) 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.

3 participants