Damans227 commented on PR #12474:
URL: https://github.com/apache/cloudstack/pull/12474#issuecomment-3773921265

   > @Damans227 Check if it's possible to remove all snapshot policies of 
expunged / non-existing volumes during the upgrade (as one-time task as these 
are not applicable any more, and not relevant to show them in the UI). I think, 
it's better to remove all the snapshot policies associated with the volume 
during expunge volume itself, and refer them with _findByIdIncluding Removed()_ 
wherever the snapshot policy is referred for the existing snapshots for the 
expunged volumes.
   
   @sureshanaparti So, the policies are already deleted during volume destroy - 
[VolumeServiceImpl.destroyVolume() calls 
snapshotMgr.deletePoliciesForVolume()](https://github.com/apache/cloudstack/blob/main/engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java#L1659).
   
   The issue seems to me is when an orphaned policy exists due to an edge case 
(eg: failures, etc.). To reproduce the issue, I had to manually insert a record 
in DB to simulate an orphan policy. This fix allows handling those orphans 
created via UI/ API. Example: 
   
   <img width="1500" height="750" alt="Screenshot from 2026-01-17 16-29-15" 
src="https://github.com/user-attachments/assets/ae45957a-9112-464f-8ae6-cbb58ff42cb1";
 />
   
   An upgrade script to clean existing orphans is a good idea. Lemme know if I 
shall further investigate that? 


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

Reply via email to