rhtyd commented on a change in pull request #5017:
URL: https://github.com/apache/cloudstack/pull/5017#discussion_r638735679
##########
File path:
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java
##########
@@ -1030,10 +1031,12 @@ protected void runInContext() {
// Sync out-of-band backups
backupProvider.syncBackups(vm, metric);
// Emit a usage event, update usage metric for
the VM by the usage server
-
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_BACKUP_USAGE_METRIC,
vm.getAccountId(),
- vm.getDataCenterId(), vm.getId(),
"Backup-" + vm.getHostName() + "-" + vm.getUuid(),
- vm.getBackupOfferingId(), null,
metric.getBackupSize(), metric.getDataSize(),
- Backup.class.getSimpleName(),
vm.getUuid());
+ if (metric.getBackupSize() > 0) {
+
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_BACKUP_USAGE_METRIC,
vm.getAccountId(),
Review comment:
@Pearl1594 another edge case - let's say a VM has 2GB backups, this
would have emitted the backup size and cause helper table to be updated to have
2GB backup size. Let's say if the external backup system purged old backups
(due to some policy), then if the new backup size is 0, the helper table won't
be updated with 0GB and usage records may continue to be created.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]