Addition of VM snapshots limits to the Resource tab#13288
Conversation
|
@blueorangutan package |
|
@winterhazel 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.20 #13288 +/- ##
============================================
- Coverage 16.27% 16.26% -0.02%
+ Complexity 13439 13434 -5
============================================
Files 5665 5666 +1
Lines 500555 500705 +150
Branches 60789 60807 +18
============================================
- Hits 81446 81420 -26
- Misses 410004 410178 +174
- Partials 9105 9107 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR extends CloudStack’s resource limits/counts plumbing to include VM snapshots (limit/total/available) so that the UI Resources tab can display VM snapshot limits for accounts, domains, and projects.
Changes:
- Added
vm_snapshotas aResourceType(ordinal12) and exposed corresponding fields/constants in API responses. - Extended
account_view/domain_viewDB views plus query VO/DAO mapping to fetch and compute VM snapshot limit/usage/available. - Updated the UI resource usage list and added i18n strings to render the new “VM snapshot limits” entry.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/components/view/ResourceCountUsage.vue | Adds vmsnapshot to the resources list rendered in the Resources tab. |
| ui/public/locales/pt_BR.json | Adds pt-BR label for VM snapshot limits. |
| ui/public/locales/en.json | Adds English label for VM snapshot limits. |
| server/src/main/java/com/cloud/api/query/vo/DomainJoinVO.java | Adds VM snapshot limit/total columns + accessors for domain view mapping. |
| server/src/main/java/com/cloud/api/query/vo/AccountJoinVO.java | Adds VM snapshot limit/total columns + accessors for account view mapping. |
| server/src/main/java/com/cloud/api/query/dao/DomainJoinDaoImpl.java | Computes and populates VM snapshot limit/total/available in DomainResponse. |
| server/src/main/java/com/cloud/api/query/dao/AccountJoinDaoImpl.java | Computes and populates VM snapshot limit/total/available in AccountResponse. |
| engine/schema/src/main/resources/META-INF/db/views/cloud.domain_view.sql | Exposes VM snapshot limit/total via joins to resource_limit/resource_count. |
| engine/schema/src/main/resources/META-INF/db/views/cloud.account_view.sql | Exposes VM snapshot limit/total via joins to resource_limit/resource_count. |
| api/src/main/java/org/apache/cloudstack/api/response/ResourceLimitAndCountResponse.java | Extends the shared response interface with VM snapshot setters. |
| api/src/main/java/org/apache/cloudstack/api/response/ProjectResponse.java | Adds VM snapshot fields to project responses (serialized names + setters). |
| api/src/main/java/org/apache/cloudstack/api/response/DomainResponse.java | Adds VM snapshot fields to domain responses (serialized names + setters). |
| api/src/main/java/org/apache/cloudstack/api/response/AccountResponse.java | Adds VM snapshot fields to account responses (serialized names + setters). |
| api/src/main/java/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java | Updates API parameter documentation to include type 12 (VM snapshots). |
| api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java | Updates API parameter documentation to include type 12 and vm_snapshot name. |
| api/src/main/java/org/apache/cloudstack/api/ApiConstants.java | Adds API field-name constants for VM snapshot limit/total/available. |
| api/src/main/java/com/cloud/configuration/Resource.java | Introduces ResourceType.vm_snapshot with ordinal 12. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| response.setSnapshotTotal(snapshotTotal); | ||
| response.setSnapshotAvailable(snapshotAvail); | ||
|
|
||
| Long vmSnapshotLimit = ApiDBUtils.findCorrectResourceLimitForDomain(domain.getVmSnapshotLimit(), ResourceType.vm_snapshot, domain.getId()); |
| String snapshotAvailable = (fullView || vmSnapshotLimit == -1) ? Resource.UNLIMITED : String.valueOf(vmSnapshotLimit - vmSnapshotTotal); | ||
| response.setVmSnapshotLimit(vmSnapshotLimitDisplay); | ||
| response.setVmSnapshotTotal(vmSnapshotTotal); | ||
| response.setVmSnapshotAvailable(snapshotAvailable); |
| @Param(description = "the number of VM snapshots that can be stored by this account") | ||
| private String vmSnapshotLimit; | ||
|
|
||
| @SerializedName(ApiConstants.VM_SNAPSHOT_TOTAL) | ||
| @Param(description = "the number of VM snapshots stored by this account") | ||
| private Long vmSnapshotTotal; | ||
|
|
||
| @SerializedName(ApiConstants.VM_SNAPSHOT_AVAILABLE) | ||
| @Param(description = "the number of VM snapshots available for this account") | ||
| private String vmSnapshotAvailable; |
| @Param(description = "the number of VM snapshots that can be stored by this account") | ||
| private String vmSnapshotLimit; | ||
|
|
||
| @SerializedName(ApiConstants.VM_SNAPSHOT_TOTAL) | ||
| @Param(description = "the number of VM snapshots stored by this account") | ||
| private Long vmSnapshotTotal; | ||
|
|
||
| @SerializedName(ApiConstants.VM_SNAPSHOT_AVAILABLE) | ||
| @Param(description = "the number of VM snapshots available for this account") | ||
| private String vmSnapshotAvailable; |
| private Long id; | ||
|
|
||
| @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.INTEGER, description = "Type of resource. Values are 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 and 11. " | ||
| @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.INTEGER, description = "Type of resource. Values are 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11 and 12. " |
| @Parameter(name = ApiConstants.RESOURCE_TYPE, | ||
| type = CommandType.INTEGER, | ||
| description = "Type of resource to update. If specifies valid values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and 11. If not specified will update all resource counts" | ||
| description = "Type of resource to update. If specifies valid values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12. If not specified will update all resource counts" |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18088 |
Description
Currently, information about the VM snapshot limits is not being displayed for accounts, domains or project in the
Resourcestab. Therefore, this PR adds the VM snapshots limits to thelistResourceLimitsAPI, and extends the GUI to display them.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Screenshots (if appropriate):
After the changes:
Admin tab:

User tab:

How Has This Been Tested?
I updated my test environment and observed that the VM snapshot limit was now shown in the
Resourcestab of accounts, projects and domains.