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/08/18 06:42:56 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_r690946101



##########
File path: usage/src/main/java/com/cloud/usage/parser/BackupUsageParser.java
##########
@@ -100,6 +89,33 @@ public static boolean parse(AccountVO account, Date startDate, Date endDate) {
         return true;
     }
 
+    protected static final Map<String, BackupInfo> getVmUsageMap(final List<UsageBackupVO> usageBackups) {
+        final Map<Long, Long> vmOffering = new HashMap<Long, Long>();
+        final Map<Long, Integer> vmOfferingIndex = new HashMap<Long, Integer>();
+        final Map<String, BackupInfo> vmUsageMap = new HashMap<>();
+        for (final UsageBackupVO usageBackup : usageBackups) {
+            final Long vmId = usageBackup.getVmId();
+            final Long zoneId = usageBackup.getZoneId();
+            final Long offeringId = usageBackup.getBackupOfferingId();
+            Integer index = vmOfferingIndex.get(vmId) == null ? 0 : vmOfferingIndex.get(vmId);
+            if (vmOffering.get(vmId) == null || vmOffering.get(vmId) != offeringId)  {
+                if (vmOffering.get(vmId) != null) {

Review comment:
       @GutoVeronezi  done.




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