Skip to content

Commit e158769

Browse files
author
Likitha Shetty
committed
CLOUDSTACK-3293. DeleteAccount fails with ConstraintViolation on snapshot_store_ref.
1 parent 4c924bb commit e158769

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,15 @@ public boolean deleteSnapshotDirsForAccount(long accountId) {
676676
// Either way delete the snapshots for this volume.
677677
List<SnapshotVO> snapshots = listSnapsforVolume(volumeId);
678678
for (SnapshotVO snapshot : snapshots) {
679-
if (_snapshotDao.expunge(snapshot.getId())) {
679+
SnapshotVO snap = _snapshotDao.findById(snapshot.getId());
680+
SnapshotStrategy snapshotStrategy = null;
681+
for (SnapshotStrategy strategy : snapshotStrategies) {
682+
if (strategy.canHandle(snap)) {
683+
snapshotStrategy = strategy;
684+
break;
685+
}
686+
}
687+
if (snapshotStrategy.deleteSnapshot(snapshot.getId())) {
680688
if (snapshot.getRecurringType() == Type.MANUAL) {
681689
_resourceLimitMgr.decrementResourceCount(accountId, ResourceType.snapshot);
682690
_resourceLimitMgr.decrementResourceCount(accountId, ResourceType.secondary_storage,

0 commit comments

Comments
 (0)