slavkap commented on code in PR #9270:
URL: https://github.com/apache/cloudstack/pull/9270#discussion_r1723163142
##########
engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java:
##########
@@ -504,10 +504,10 @@ public Void
deleteVolumeCallback(AsyncCallbackDispatcher<VolumeServiceImpl, Comm
if (!supportsStorageSystemSnapshots) {
_snapshotStoreDao.remove(snapStoreVo.getId());
}
- } else {
- if
(!StoragePoolType.StorPool.equals(storagePoolVO.getPoolType())) {
- _snapshotStoreDao.remove(snapStoreVo.getId());
- }
+ } else if
(HypervisorType.KVM.equals(vo.getHypervisorType())) {
Review Comment:
the StorPool plug-in supports KVM hypervisors; this change will delete the
StorPool snapshots, an action we want to avoid.
##########
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:
If the snapshots are only on the primary storage with the backup to
secondary option disabled, 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]