DaanHoogland commented on a change in pull request #3969: Snapshot deletion 
issues
URL: https://github.com/apache/cloudstack/pull/3969#discussion_r403917585
 
 

 ##########
 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:
   this comment does not seem to be in alignment with the code. How do we 
conclude that we are at this point in code because of the global setting 
'snapshot.backup.to.secondary'?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to