Add new backup report feature - #13939
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #13939 +/- ##
============================================
- Coverage 19.65% 19.62% -0.04%
+ Complexity 19803 19799 -4
============================================
Files 6368 6383 +15
Lines 574935 575848 +913
Branches 70358 70395 +37
============================================
+ Hits 113026 113030 +4
- Misses 449632 450542 +910
+ Partials 12277 12276 -1
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:
|
GaOrtiga
left a comment
There was a problem hiding this comment.
@JoaoJandre I ran some tests, overall LGTM, just a few minor nits
If a backup was created within the gathered period, but has been removed after, it appears as a deleted backup and shows 0 total storage. Given that the deletion happened after the period, it should show as a succesful backup. Same for a failed backup, where the failure reason is not showed.
API return
(admin) 🐱 > get backupreport startdate='2026-08-01' enddate='2026-08-23T11:59:59-0300' domainid=517e680a-dc14-4cac-98ab-5b6a21a2ac36
{
"backupreport": {
"backupstoragetotal": 0,
"domainreport": [
{
"accountreport": [
{
"account": "userc",
"accountid": "62f2b1f0-4373-4983-84a0-5e74b1558002",
"backupstoragetotal": 0,
"deletedbackup": [
{
"backupofferingname": "a",
"created": "2026-08-23T11:25:46-0300",
"id": "05c18465-4986-4d85-a119-00a469c35cb7",
"name": "VM-75e8ffef-9ae6-47fb-bca8-b1724fab8f63-2026-08-24T11:25:45.937948704-03:00",
"removed": "2026-08-24T11:30:21-0300",
"virtualmachineid": "75e8ffef-9ae6-47fb-bca8-b1724fab8f63",
"virtualmachinename": "VM-75e8ffef-9ae6-47fb-bca8-b1724fab8f63",
"zone": "zone",
"zoneid": "b25d0ef2-b171-4885-beec-21a27044f07c"
}
],
"failedbackup": [],
"sucessfulbackup": []
}
],
"backupstoragetotal": 0,
"domain": "c",
"domainid": "517e680a-dc14-4cac-98ab-5b6a21a2ac36"
}
],
"enddate": "2026-08-23T11:59:59-0300",
"providerinfo": [
{
"compressionreport": []
},
{
"validationreport": []
}
],
"schedulereport": [],
"startdate": "2026-08-01T00:00:00-0300"
}
}
|
|
||
| public class Upgrade42020to42030 extends DbUpgradeAbstractImpl implements DbUpgrade, DbUpgradeSystemVmTemplate { | ||
|
|
||
| private static String SELECT_TEMPLATE = "SELECT `name` FROM `cloud`.`email_template` WHERE `name`=\"backup_report_template\";"; |
There was a problem hiding this comment.
@JoaoJandre Why are these changes necessary? Adding them to the 4.23 (or 24) shouldn't be enough?
|
|
||
| @APICommand(name = "getBackupReport", | ||
| description = "Get the backup report for the given period", | ||
| responseObject = BackupReportResponse.class, since = "4.24.0.0", authorized = {RoleType.Admin}) |
There was a problem hiding this comment.
| responseObject = BackupReportResponse.class, since = "4.24.0.0", authorized = {RoleType.Admin}) | |
| responseObject = BackupReportResponse.class, since = "24.0.0", authorized = {RoleType.Admin}) |
|
|
||
| protected void run() { | ||
| ThreadContext.put(LOGCONTEXTID, UuidUtils.first(UUID.randomUUID().toString())); | ||
| logger.info("Starting backup report task."); |
There was a problem hiding this comment.
This runs even if the task is disabled. Could we add the disable check before this? can be a little confusing for the operator
Description
This PR adds a feature for periodically sending basic backup reports to operators. To enable backup reports, the environment's alert email settings must be configured beforehand. To configure the report task, the following settings have been added:
backup.report.task.enabledfalsebackup.report.periodbackup.report.periodminutes, as well as a forecast of the next execution of backup schedules that may potentially run during the nextbackup.report.periodminutes.1440backup.report.timeout10Additionally, the
getBackupReportAPI has been added to generate reports through the API. This API returns the report in the API response and does not send emails to operators. The API supports the following parameters:zoneiddomainidaccountidprojectid.projectidaccountid.startdateenddateThis API is only available to
Adminaccounts.API Usage Example
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
Example generated email:
How Has This Been Tested?
getBackupReportAPI passing only startdate and enddategetBackupReportAPI specifying the domaingetBackupReportAPI specifying the accountgetBackupReportAPI specifying the project