You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by li...@apache.org on 2013/07/16 11:19:32 UTC

git commit: updated refs/heads/4.2 to e158769

Updated Branches:
  refs/heads/4.2 4c924bb83 -> e15876944


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/e1587694
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e1587694
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e1587694

Branch: refs/heads/4.2
Commit: e15876944bbcf3badbb4e03395fc1e8fcc8abd00
Parents: 4c924bb
Author: Likitha Shetty <li...@citrix.com>
Authored: Tue Jul 16 13:41:31 2013 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Tue Jul 16 14:36:57 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/e1587694/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,