DaanHoogland commented on code in PR #9239:
URL: https://github.com/apache/cloudstack/pull/9239#discussion_r1638427195


##########
server/src/main/java/org/apache/cloudstack/snapshot/SnapshotHelper.java:
##########
@@ -101,15 +101,21 @@ public void expungeTemporarySnapshot(boolean 
kvmSnapshotOnlyInPrimaryStorage, Sn
             return;
         }
 
-        logger.debug(String.format("Expunging snapshot [%s] due to it is a 
temporary backup to create a volume from snapshot. It is occurring because the 
global setting [%s]"
-          + " has the value [%s].", snapInfo.getId(), 
SnapshotInfo.BackupSnapshotAfterTakingSnapshot.key(), 
backupSnapshotAfterTakingSnapshot));
-
-        try {
-            snapshotService.deleteSnapshot(snapInfo);
-        } catch (CloudRuntimeException ex) {
-            logger.warn(String.format("Unable to delete the temporary snapshot 
[%s] on secondary storage due to [%s]. We still will expunge the database 
reference, consider"
-              + " manually deleting the file [%s].", snapInfo.getId(), 
ex.getMessage(), snapInfo.getPath()), ex);
+        if (!snapInfo.getDataStore().getRole().equals(DataStoreRole.Image)) {

Review Comment:
   ```suggestion
           if (!DataStoreRole.Image.equals(snapInfo.getDataStore().getRole())) {
   ```
   to make sure no NPE happens?



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to