@@ -387,6 +387,7 @@ public AsyncCallFuture<VolumeApiResult> expungeVolumeAsync(VolumeInfo volume) {
387387 logger .info ("Expunge volume with no data store specified" );
388388 if (canVolumeBeRemoved (volume .getId ())) {
389389 logger .info ("Volume {} is not referred anywhere, remove it from volumes table" , volume );
390+ snapshotMgr .deletePoliciesForVolume (volume .getId ());
390391 volDao .remove (volume .getId ());
391392 }
392393 future .complete (result );
@@ -422,6 +423,7 @@ public AsyncCallFuture<VolumeApiResult> expungeVolumeAsync(VolumeInfo volume) {
422423 }
423424 VMTemplateVO template = templateDao .findById (vol .getTemplateId ());
424425 if (template != null && !template .isDeployAsIs ()) {
426+ snapshotMgr .deletePoliciesForVolume (vol .getId ());
425427 volDao .remove (vol .getId ());
426428 future .complete (result );
427429 return future ;
@@ -493,6 +495,7 @@ public Void deleteVolumeCallback(AsyncCallbackDispatcher<VolumeServiceImpl, Comm
493495
494496 if (canVolumeBeRemoved (vo .getId ())) {
495497 logger .info ("Volume {} is not referred anywhere, remove it from volumes table" , vo );
498+ snapshotMgr .deletePoliciesForVolume (vo .getId ());
496499 volDao .remove (vo .getId ());
497500 }
498501
@@ -1657,7 +1660,6 @@ public void destroyVolume(long volumeId) {
16571660 // mark volume entry in volumes table as destroy state
16581661 VolumeInfo vol = volFactory .getVolume (volumeId );
16591662 vol .stateTransit (Volume .Event .DestroyRequested );
1660- snapshotMgr .deletePoliciesForVolume (volumeId );
16611663 annotationDao .removeByEntityType (AnnotationService .EntityType .VOLUME .name (), vol .getUuid ());
16621664
16631665 vol .stateTransit (Volume .Event .OperationSucceeded );
0 commit comments