Skip to content

Commit 0d25a22

Browse files
Fixes VM snapshot usage records that are attributed to the old snapshot
1 parent 2e63c60 commit 0d25a22

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎usage/src/main/java/com/cloud/usage/parser/VMSnapshotUsageParser.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected boolean parse(AccountVO account, Date startDate, Date endDate) {
6565
long zoneId = usageRec.getZoneId();
6666
Long volId = usageRec.getVolumeId();
6767
long vmId = usageRec.getVmId();
68-
String key = vmId + ":" + volId;
68+
String key = vmId + ":" + volId + ":" + usageRec.getVmSnapshotId();
6969
if (usageRec.getCreated().before(startDate)) {
7070
unprocessedUsage.put(key, usageRec);
7171
continue;
@@ -85,7 +85,7 @@ protected boolean parse(AccountVO account, Date startDate, Date endDate) {
8585
long duration = (createDate.getTime() - previousCreated.getTime()) + 1;
8686

8787
createUsageRecord(UsageTypes.VM_SNAPSHOT, duration, previousCreated, createDate, account, volId, zoneId, previousEvent.getDiskOfferingId(), vmId,
88-
previousEvent.getSize(), usageRec.getVmSnapshotId());
88+
previousEvent.getSize(), previousEvent.getVmSnapshotId());
8989
previousEvent.setProcessed(new Date());
9090
usageVMSnapshotDao.update(previousEvent);
9191

0 commit comments

Comments
 (0)