-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Update storage usage / size in backup usage response #12539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.20
Are you sure you want to change the base?
Update storage usage / size in backup usage response #12539
Conversation
|
@blueorangutan package |
|
@sureshanaparti 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 #12539 +/- ##
============================================
- Coverage 16.26% 16.25% -0.01%
- Complexity 13418 13421 +3
============================================
Files 5658 5659 +1
Lines 499494 499645 +151
Branches 60625 60635 +10
============================================
+ Hits 81232 81236 +4
- Misses 409214 409358 +144
- Partials 9048 9051 +3
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the backup usage response to include storage size information that was previously stored but not exposed through the API.
Changes:
- Removed unused
rawUsagevariable from BackupUsageParser - Modernized Double instantiation to use primitive casting in BackupUsageParser and VMSnapshotOnPrimaryParser
- Added size and virtualSize fields to backup usage API response
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| usage/src/main/java/com/cloud/usage/parser/BackupUsageParser.java | Removed unused variable and modernized Double casting for better code quality |
| usage/src/main/java/com/cloud/usage/parser/VMSnapshotOnPrimaryParser.java | Modernized Double casting from new Double(usage) to (double) usage |
| server/src/main/java/com/cloud/api/ApiResponseHelper.java | Added setSize() and setVirtualSize() calls to populate backup storage metrics in usage response |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16596 |
DaanHoogland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm
abh1sar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to fix the print statement in createUsageResponse
} else if (usageRecord.getUsageType() == UsageTypes.BACKUP) {
resourceType = ResourceObjectType.Backup;
final StringBuilder builder = new StringBuilder();
builder.append("Backup usage of size ").append(usageRecord.getUsageDisplay());
if (vmInstance != null) {
resourceId = vmInstance.getId();
usageRecResponse.setResourceName(vmInstance.getInstanceName());
usageRecResponse.setUsageId(vmInstance.getUuid());
builder.append(" for VM ").append(vmInstance.getHostName())
.append(" (").append(vmInstance.getUuid()).append(")");
final BackupOffering backupOffering = backupOfferingDao.findByIdIncludingRemoved(usageRecord.getOfferingId());
if (backupOffering != null) {
builder.append(" and backup offering ").append(backupOffering.getName())
.append(" (").append(backupOffering.getUuid()).append(", user ad-hoc/scheduled backup allowed: ")
.append(backupOffering.isUserDrivenBackupAllowed()).append(")");
}
}
Is should say something like
Backup usage for VM .. and backup offering ... with size (usageRecord.getSize()
Currently it shows
Snapshot usage for reference
|
@blueorangutan package |
|
@blueorangutan package |
|
@sureshanaparti 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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16625 |
|
@blueorangutan test |
|
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
Description
This PR updates storage usage / size in backup usage response.
Fixes #12536
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?