winterhazel opened a new pull request, #7832: URL: https://github.com/apache/cloudstack/pull/7832
### Description After #6046 changes, CloudStack stopped incrementing the number of public IPs an account has allocated when a user acquires a new IP for a guest network, allowing them to allocate more public IPs than their account's limit. This PR intends to fix the behavior and honor the account's IP address limit. On top of that, the method `updateIpResourceCount` was refactored and renamed to `checkIfIpResourceCountShouldBeUpdated`. ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [X] 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 #### Bug Severity - [ ] BLOCKER - [ ] Critical - [X] Major - [ ] Minor - [ ] Trivial ### Screenshots (if appropriate): ### How Has This Been Tested? Everything has been tested in a local lab. Tests related to the public IPs count: - I acquired a public IP for a guest network and verified that the account's number of allocated public IPs was incremented; - I acquired a public IP for a VPC and verified that the account's number of allocated public IPs was incremented. Tests related to the feature that introduced the bug: - I reserved a public IP and verified that the IP was successfully reserved and the account's number of public IPs incremented; - I released a reserved public IP and verified that the IP was successfully released and the account's number of public IPs decremented. - Through the `associateIpAddress` API, I associated a reserved IP to a guest network. Then, I verified that the IP was successfully associated, that its state changed from `Reserved` to `Allocated` and that the account's number of allocated public IPs did not change. Tests related to `updateIpResourceCount`: - I added unit tests that passed before refactoring, refactored the function and checked they were still passing. -- 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]
