Skip to content

Addition of instance snapshots limits to the resource tab - #14137

Open
GeanJair wants to merge 2 commits into
apache:mainfrom
scclouds:add-vm-snapshot-limits-to-resource-tab
Open

GeanJair wants to merge 2 commits into
apache:mainfrom
scclouds:add-vm-snapshot-limits-to-resource-tab

Conversation

@GeanJair

Copy link
Copy Markdown
Contributor

Description

Currently, instance snapshot limits are not implemented in Apache CloudStack. Therefore, this PR adds the instance snapshots limits to the listResourceLimits API, and extends the GUI to display them for accounts, domains and projects in the Resources tab.

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)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

Account resources's tab

image

Domain resources's tab

image

Project resources's tab

image

How Has This Been Tested?

  • I observed that the instance snapshot limit was now shown in the Resources tab of accounts, projects and domains.
  • I created and deleted instance snapshots, to verified that the field was being incremented and decremented correctly.
  • I tried to create more instance snapshots than the allowed and certified that the defined limit was correctly respected.

@codecov

codecov Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 11.84211% with 67 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.89%. Comparing base (d87c804) to head (096a4db).
⚠️ Report is 124 commits behind head on main.

Files with missing lines Patch % Lines
...pache/cloudstack/api/response/AccountResponse.java 0.00% 9 Missing ⚠️
...apache/cloudstack/api/response/DomainResponse.java 0.00% 9 Missing ⚠️
...pache/cloudstack/api/response/ProjectResponse.java 0.00% 9 Missing ⚠️
.../cloud/resourcelimit/ResourceLimitManagerImpl.java 0.00% 8 Missing ⚠️
...va/com/cloud/api/query/dao/AccountJoinDaoImpl.java 0.00% 7 Missing ⚠️
...ava/com/cloud/api/query/dao/DomainJoinDaoImpl.java 0.00% 7 Missing ⚠️
...ain/java/com/cloud/api/query/vo/AccountJoinVO.java 0.00% 6 Missing ⚠️
...main/java/com/cloud/api/query/vo/DomainJoinVO.java 0.00% 6 Missing ⚠️
...a/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java 40.00% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14137      +/-   ##
============================================
+ Coverage     19.78%   19.89%   +0.10%     
- Complexity    19995    20141     +146     
============================================
  Files          6371     6371              
  Lines        575909   576902     +993     
  Branches      70509    70635     +126     
============================================
+ Hits         113950   114761     +811     
- Misses       449526   449598      +72     
- Partials      12433    12543     +110     
Flag Coverage Δ
uitests 3.71% <ø> (+0.18%) ⬆️
unittests 21.16% <11.84%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bernardodemarco

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@bernardodemarco a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19505

}

try {
resourceLimitMgr.incrementResourceCount(caller.getAccountId(), Resource.ResourceType.instance_snapshot);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this count go on the owner of the instance instead of the caller? when an admin snapshots a users instance the admins count goes up but the limit is checked on the user


return false;
if (success) {
resourceLimitMgr.decrementResourceCount(caller.getAccountId(), Resource.ResourceType.instance_snapshot);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens when an instance is destroyed with snapshots still on it? that path removes them without lowering the count, so it only goes up

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants