bug 9778: Log snapshot create event only if the snapshot is in not removed state after backingUp to secondary. Log snapshot delete event for backed up snapshots only

status 9778: resolved fixed
This commit is contained in:
kishan 2011-09-12 20:22:07 +05:30
parent 5928a9b370
commit b30827a0ec
1 changed files with 3 additions and 2 deletions

View File

@ -419,8 +419,9 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
// Cleanup jobs to do after the snapshot has been created; decrement resource count
if (snapshot != null) {
postCreateSnapshot(volumeId, snapshot.getId(), policyId, backedUp);
if (backedUp && (snapshot.getRemoved() == null)) {
//Check if the snapshot was removed while backingUp. If yes, do not log snapshot create usage event
SnapshotVO freshSnapshot = _snapshotDao.findById(snapshot.getId());
if ((freshSnapshot != null) && backedUp) {
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_SNAPSHOT_CREATE, snapshot.getAccountId(), snapshot.getDataCenterId(), snapshotId, snapshot.getName(), null, null,
v.getSize());
_usageEventDao.persist(usageEvent);