Conversation
…rrectly listDomains reported the bucket and object storage limits of every non-root domain as Unlimited, whatever was configured. DomainJoinDaoImpl resolved those two through ApiDBUtils.findCorrectResourceLimit, which is the account variant: it looks the id up in the account table. Given a domain id it finds either the root admin account or no account, and answers unlimited either way. The other fifteen resource types already go through findCorrectResourceLimitForDomain. The backup and backup storage rows had their unlimited checks copied from the row above: the backup limit was hidden whenever the snapshot limit was unlimited, and the backup storage limit whenever the backup limit was. listResourceLimits was never affected, which is why the values set through updateResourceLimit read back correctly there and only the usage view in the UI, which reads listDomains, showed them as Unlimited. Fixes apache#13944
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Fixes #13944
listDomainsreports the bucket and object storage limits of every non-root domain asUnlimited, whatever has been configured. @ms30063600's re-test on #13944 shows it clearly: all 17 limits read back correctly fromlistResourceLimits, but the usage view (which readslistDomains) shows Bucket and Object Storage as Unlimited.DomainJoinDaoImpl.setResourceLimitsresolves those two types through the account helper:findCorrectResourceLimit(limit, accountId, type)delegates toResourceLimitManagerImpl.findCorrectResourceLimitForAccount, which first checksisRootAdmin(accountId)and then_accountDao.findById(accountId), returning unlimited for either. Passed a domain id, it is looking up an unrelated account — typically the root admin (account 2 vs. a domain with id 2) or nothing at all — so the configured limit is never reached. The other fifteen types in this method already usefindCorrectResourceLimitForDomain; this changes the two outliers to match.While in there, the backup rows had their unlimited checks copied from the row above:
so a domain with unlimited snapshots shows its backup limit as Unlimited, and one with unlimited backups shows its backup storage limit as Unlimited.
AccountJoinDaoImpldoes not have either problem.Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
Added
DomainJoinDaoImplTest, which callssetResourceLimitsdirectly withApiDBUtilsstubbed (the domain lookup returns the domain's own limit; the account lookup returns unlimited, as it does in practice for a domain id) and verifies the values set on the response:147/157Without the change to
DomainJoinDaoImpl, all three fail.mvn checkstyle:check -pl serverreports no violations.I do not have a live environment to check the UI against, so this is unit-level; the reporter's JSON and screenshots on #13944 are the end-to-end reproduction.
One thing I could not explain from the code: the same screenshot shows VPC as "77 Available" but "0 / 67". Both values come from the same
vpcLimitvariable in this method, so that mismatch does not originate here and this PR does not address it.