Updated Branches: refs/heads/master 1c43c9576 -> 22ddc3fa0
CLOUDSTACK-3293. DeleteAccount fails with ConstraintViolation on snapshot_store_ref. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/22ddc3fa Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/22ddc3fa Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/22ddc3fa Branch: refs/heads/master Commit: 22ddc3fa0644b9dae6bbbc6e87d425d11f574f30 Parents: 1c43c95 Author: Likitha Shetty <[email protected]> Authored: Tue Jul 16 13:41:31 2013 +0530 Committer: Likitha Shetty <[email protected]> Committed: Tue Jul 16 13:45:11 2013 +0530 ---------------------------------------------------------------------- .../com/cloud/storage/snapshot/SnapshotManagerImpl.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/22ddc3fa/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 a67316f..2c9ef82 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -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,
