You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/09/02 08:06:16 UTC

[GitHub] [cloudstack] weizhouapache commented on a change in pull request #5259: usage: create backup usage record for vmId-offeringId pair

weizhouapache commented on a change in pull request #5259:
URL: https://github.com/apache/cloudstack/pull/5259#discussion_r700849081



##########
File path: usage/src/main/java/com/cloud/usage/parser/BackupUsageParser.java
##########
@@ -68,18 +68,7 @@ public static boolean parse(AccountVO account, Date startDate, Date endDate) {
             return true;
         }
 
-        final Map<Long, BackupInfo> vmUsageMap = new HashMap<>();
-        for (final UsageBackupVO usageBackup : usageBackups) {
-            final Long vmId = usageBackup.getVmId();
-            final Long zoneId = usageBackup.getZoneId();
-            final Long offeringId = usageBackup.getBackupOfferingId();
-            if (vmUsageMap.get(vmId) == null) {
-                vmUsageMap.put(vmId, new BackupUsageParser.BackupInfo(new Backup.Metric(0L, 0L), zoneId, vmId, offeringId));
-            }
-            final Backup.Metric metric = vmUsageMap.get(vmId).getMetric();
-            metric.setBackupSize(metric.getBackupSize() + usageBackup.getSize());
-            metric.setDataSize(metric.getDataSize() + usageBackup.getProtectedSize());
-        }
+        Map<String, BackupInfo> vmUsageMap = getVmUsageMap(usageBackups);

Review comment:
       @rhtyd 
   updated this pr to display the duration of backup offering in the period (see Pearl's testing result).
   since you are the author of backup and restore framework, could you please review it ?




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org