diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index ce3a1e794c3..fb9ec416401 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -697,7 +697,10 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma s_logger.debug("Calling deleteSnapshot for snapshotId: " + snapshotId + " and policyId " + policyId); } SnapshotVO lastSnapshot = null; + SnapshotVO snapshot = _snapshotDao.findById(snapshotId); _snapshotDao.remove(snapshotId); + UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_SNAPSHOT_DELETE, snapshot.getAccountId(), 0L, snapshotId, snapshot.getName(), null, null, 0L); + _usageEventDao.persist(usageEvent); long lastId = snapshotId; boolean destroy = false; while( true ) { @@ -789,11 +792,6 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma s_logger.error(details); } - if(success){ - UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_SNAPSHOT_DELETE, snapshot.getAccountId(), volume.getDataCenterId(), snapshotId, snapshot.getName(), null, null, volume.getSize()); - _usageEventDao.persist(usageEvent); - } - return success; }