CLOUDSTACK-3293. DeleteAccount fails with ConstraintViolation on snapshot_store_ref.

This commit is contained in:
Likitha Shetty 2013-07-16 13:41:31 +05:30
parent 1c43c95767
commit 22ddc3fa06

View File

@ -676,7 +676,15 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
// Either way delete the snapshots for this volume.
List<SnapshotVO> snapshots = listSnapsforVolume(volumeId);
for (SnapshotVO snapshot : snapshots) {
if (_snapshotDao.expunge(snapshot.getId())) {
SnapshotVO snap = _snapshotDao.findById(snapshot.getId());
SnapshotStrategy snapshotStrategy = null;
for (SnapshotStrategy strategy : snapshotStrategies) {
if (strategy.canHandle(snap)) {
snapshotStrategy = strategy;
break;
}
}
if (snapshotStrategy.deleteSnapshot(snapshot.getId())) {
if (snapshot.getRecurringType() == Type.MANUAL) {
_resourceLimitMgr.decrementResourceCount(accountId, ResourceType.snapshot);
_resourceLimitMgr.decrementResourceCount(accountId, ResourceType.secondary_storage,