Skip to content

Commit ad64ee3

Browse files
authored
[Usage] Fix wrong usage_type (#7229)
1 parent 8592de9 commit ad64ee3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,3 +1574,12 @@ CREATE VIEW `cloud`.`user_view` AS
15741574
-- Remove snapshot references if primary storage pool has been removed, see github issue #7093
15751575
DELETE FROM `cloud`.`snapshot_store_ref`
15761576
WHERE store_role = "Primary" AND store_id IN (SELECT id FROM storage_pool WHERE removed IS NOT NULL);
1577+
1578+
1579+
-- Change usage of VM_DISK_IO_WRITE to use right usage_type
1580+
UPDATE
1581+
`cloud_usage`.`cloud_usage`
1582+
SET
1583+
usage_type = 22
1584+
WHERE
1585+
usage_type = 24 AND usage_display like '% io write';

usage/src/main/java/com/cloud/usage/parser/VmDiskUsageParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public static boolean parse(AccountVO account, Date startDate, Date endDate) {
134134
usageDesc += " for Vm: " + vmId + " and Volume: " + volumeId;
135135
}
136136
usageRecord =
137-
new UsageVO(vmDiskInfo.getZoneId(), account.getId(), account.getDomainId(), usageDesc, ioWrite + " io write", UsageTypes.VM_DISK_BYTES_WRITE,
137+
new UsageVO(vmDiskInfo.getZoneId(), account.getId(), account.getDomainId(), usageDesc, ioWrite + " io write", UsageTypes.VM_DISK_IO_WRITE,
138138
new Double(ioWrite), vmId, null, null, null, vmDiskInfo.getVolumeId(), startDate, endDate, "VirtualMachine");
139139
usageRecords.add(usageRecord);
140140

0 commit comments

Comments
 (0)