[Usage] Fix wrong usage_type (#7229)

This commit is contained in:
SadiJr 2023-03-03 09:10:38 -03:00 committed by GitHub
parent 8592de95fa
commit ad64ee3090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -1574,3 +1574,12 @@ CREATE VIEW `cloud`.`user_view` AS
-- Remove snapshot references if primary storage pool has been removed, see github issue #7093
DELETE FROM `cloud`.`snapshot_store_ref`
WHERE store_role = "Primary" AND store_id IN (SELECT id FROM storage_pool WHERE removed IS NOT NULL);
-- Change usage of VM_DISK_IO_WRITE to use right usage_type
UPDATE
`cloud_usage`.`cloud_usage`
SET
usage_type = 22
WHERE
usage_type = 24 AND usage_display like '% io write';

View File

@ -134,7 +134,7 @@ public class VmDiskUsageParser {
usageDesc += " for Vm: " + vmId + " and Volume: " + volumeId;
}
usageRecord =
new UsageVO(vmDiskInfo.getZoneId(), account.getId(), account.getDomainId(), usageDesc, ioWrite + " io write", UsageTypes.VM_DISK_BYTES_WRITE,
new UsageVO(vmDiskInfo.getZoneId(), account.getId(), account.getDomainId(), usageDesc, ioWrite + " io write", UsageTypes.VM_DISK_IO_WRITE,
new Double(ioWrite), vmId, null, null, null, vmDiskInfo.getVolumeId(), startDate, endDate, "VirtualMachine");
usageRecords.add(usageRecord);