erikbocks opened a new pull request, #11076:
URL: https://github.com/apache/cloudstack/pull/11076
### 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)
- [x] 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
- [x] Minor
### How Has This Been Tested?
I made the following tests:
| N° | 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 |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]