Repository navigation
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
|
Reproduced this on a 4.23 build and the change resolves it. On a non-root domain with the limits set through
With this PR applied, the same That lines up with both the account-vs-domain helper on the bucket and object-storage lines and the snapshot/backup mix-up in the backup rows. |
|
For anyone looking at CI: the 8 workflow runs on the current head ( @DaanHoogland, since you were on #13944, could you or another committer approve the workflow runs? Thanks. |
|
@blueorangutan package |
|
@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. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14293 +/- ##
============================================
+ Coverage 18.00% 18.01% +0.01%
- Complexity 16219 16223 +4
============================================
Files 5936 5936
Lines 535716 535716
Branches 65596 65596
============================================
+ Hits 96459 96517 +58
+ Misses 428268 428161 -107
- Partials 10989 11038 +49
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
||
| //get resource limits for buckets | ||
| long bucketLimit = ApiDBUtils.findCorrectResourceLimit(domain.getBucketLimit(), domain.getId(), ResourceType.bucket); | ||
| long bucketLimit = ApiDBUtils.findCorrectResourceLimitForDomain(domain.getBucketLimit(), ResourceType.bucket, domain.getId()); |
There was a problem hiding this comment.
what happens if the domain has no bucket limit set? looks like the fallback only reads max.domain.buckets for storage types, so this still shows unlimited while creating stops at 20
There was a problem hiding this comment.
Good catch, you're right. When a domain has no limit of its own, ApiDBUtils.findCorrectResourceLimitForDomain(Long, ResourceType, long) fell back to findDefaultResourceLimitForDomain, which only applies the max.domain.* default to storage types and returns unlimited for everything else, while enforcement uses ResourceLimitService.findCorrectResourceLimitForDomain (parent domain's limit, then the default). So it wasn't only buckets: IPs, volumes, snapshots, networks, CPU and memory showed unlimited the same way; VMs looked right because they already go through the other overload.
I've pushed a change (8f6592a) so that fallback uses the same lookup as enforcement, with a unit test that fails without it (expected:<20> but was:<-1>). One thing to be aware of: this means a domain without its own limits will now show the inherited or default limits for those types instead of "Unlimited", which is what's actually enforced.
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19532 |
… own When a domain has no limit set, the domain response fell back to findDefaultResourceLimitForDomain, which only reads the max.domain.* default for storage types and answers unlimited for the rest. Creating a resource still stops at the default (or at a parent domain's limit), so for example the bucket limit showed unlimited while bucket creation stopped at 20. Use the same lookup that is enforced.
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.