Repository: cloudstack Updated Branches: refs/heads/4.5 aaa561a28 -> 265219501
CLOUDSTACK-7825: Report both virtual size and physical size for the snaphost usage event. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/26521950 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/26521950 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/26521950 Branch: refs/heads/4.5 Commit: 2652195010c86fa399493a041afff3eac17b1538 Parents: aaa561a Author: Nitin Mehta <nitin.me...@citrix.com> Authored: Fri Oct 31 15:24:32 2014 -0700 Committer: Nitin Mehta <nitin.me...@citrix.com> Committed: Fri Oct 31 15:24:32 2014 -0700 ---------------------------------------------------------------------- .../src/com/cloud/storage/snapshot/SnapshotManagerImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26521950/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index 76ab370..6d74636 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -971,11 +971,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) {