From 138366804d2beafe1809770bbe415392a0e0b973 Mon Sep 17 00:00:00 2001 From: Nitin Mehta Date: Fri, 31 Oct 2014 15:24:32 -0700 Subject: [PATCH] CLOUDSTACK-7825: Report both virtual size and physical size for the snaphost usage event. --- .../com/cloud/storage/snapshot/SnapshotManagerImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index f2126efbf74..ac013c40842 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -985,11 +985,11 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, snapshotStrategy.takeSnapshot(snapshot); try { - postCreateSnapshot(volume.getId(), snapshotId, payload.getSnapshotPolicyId()); - - UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_CREATE, snapshot.getAccountId(), snapshot.getDataCenterId(), snapshotId, snapshot.getName(), - null, null, volume.getSize(), snapshot.getClass().getName(), snapshot.getUuid()); + postCreateSnapshot(volume.getId(), snapshotId, payload.getSnapshotPolicyId()); SnapshotDataStoreVO snapshotStoreRef = _snapshotStoreDao.findBySnapshot(snapshotId, DataStoreRole.Image); + // FIXME - snapshotStoreRef.getSize() refers to physical size, correct that + UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_CREATE, snapshot.getAccountId(), snapshot.getDataCenterId(), snapshotId, snapshot.getName(), + null, null, snapshotStoreRef.getSize(), volume.getSize(), snapshot.getClass().getName(), snapshot.getUuid()); // Correct the resource count of snapshot in case of delta snapshots. _resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.secondary_storage, new Long(volume.getSize() - snapshotStoreRef.getSize())); } catch (Exception e) {