slavkap commented on code in PR #9270:
URL: https://github.com/apache/cloudstack/pull/9270#discussion_r1728883006


##########
engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java:
##########
@@ -522,6 +522,21 @@ public Void 
deleteVolumeCallback(AsyncCallbackDispatcher<VolumeServiceImpl, Comm
         return null;
     }
 
+    /**
+     * Deletes the snapshot from primary storage if the only storage 
associated with the snapshot is of the Primary role; else, just removes the 
primary record on the DB.
+     * */
+    protected void deleteKvmSnapshotOnPrimary(SnapshotDataStoreVO 
snapshotDataStoreVO) {
+        List<SnapshotDataStoreVO> snapshotDataStoreVOList = 
_snapshotStoreDao.findBySnapshotId(snapshotDataStoreVO.getSnapshotId());
+        for (SnapshotDataStoreVO snapshotStore : snapshotDataStoreVOList) {
+            if (DataStoreRole.Image.equals(snapshotStore.getRole())) {
+                _snapshotStoreDao.remove(snapshotDataStoreVO.getId());
+                return;
+            }
+        }
+
+        snapshotApiService.deleteSnapshot(snapshotDataStoreVO.getSnapshotId(), 
null);

Review Comment:
   yes, I know about the garbage left (because before the change CS only 
deleted the DB records) but I mean do we want to delete them



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