For assignVM, marking older snapshots removed in db

This commit is contained in:
Abhinandan Prateek 2012-08-23 12:22:02 +05:30
parent 6f26894eaf
commit 3298a481a8
1 changed files with 5 additions and 0 deletions

View File

@ -3463,6 +3463,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
_resourceLimitMgr.incrementResourceCount(newAccount.getAccountId(), ResourceType.volume);
_usageEventDao.persist(new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE, volume.getAccountId(), volume.getDataCenterId(), volume.getId(), volume.getName(),
volume.getDiskOfferingId(), volume.getTemplateId(), volume.getSize()));
//snapshots: mark these removed in db
List<SnapshotVO> snapshots = _snapshotDao.listByVolumeIdIncludingRemoved(volume.getId());
for (SnapshotVO snapshot: snapshots){
_snapshotDao.remove(snapshot.getId());
}
}
_resourceLimitMgr.incrementResourceCount(newAccount.getAccountId(), ResourceType.user_vm);