Flexibilize public IP selection #11076
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
How Has This Been Tested?
I made the following tests: