You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/04/06 09:05:50 UTC

[GitHub] [cloudstack] harikrishna-patnala commented on a change in pull request #3969: Snapshot deletion issues

harikrishna-patnala commented on a change in pull request #3969: Snapshot deletion issues
URL: https://github.com/apache/cloudstack/pull/3969#discussion_r403937237
 
 

 ##########
 File path: engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/DefaultSnapshotStrategy.java
 ##########
 @@ -285,7 +284,27 @@ public boolean deleteSnapshot(Long snapshotId) {
             }
         }
 
-        boolean deletedOnPrimary = deleteSnapshotOnPrimary(snapshotId);
+        boolean deletedOnPrimary = false;
+        snapshotVO = snapshotDao.findById(snapshotId);
+        SnapshotInfo snapshotOnPrimaryInfo = snapshotDataFactory.getSnapshot(snapshotId, DataStoreRole.Primary);
+        if (snapshotVO != null && snapshotVO.getState() == Snapshot.State.Destroyed) {
+            deletedOnPrimary = deleteSnapshotOnPrimary(snapshotId, snapshotOnPrimaryInfo);
+        } else {
+            // This is to handle snapshots which are created only on primary when snapshot.backup.to.secondary is set to false. 
 
 Review comment:
   There is will be only 'Primary' store entry in snapshot_store_ref table for a snapshot created when snapshot.backup.to.secondary is set to false. so deletion of snapshot on secondary store will fail and it won't mark snapshot as destroyed and then goes to 'else' case. In other case (snapshot.backup.to.secondary is set to true) 'Image' and 'Primary' entries will be there in which it goes to 'if' case. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services