[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15925905#comment-15925905
 ] 

ASF GitHub Bot commented on CLOUDSTACK-9706:
--------------------------------------------

Github user koushik-das commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1867#discussion_r106134695
  
    --- Diff: 
engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
 ---
    @@ -194,18 +194,22 @@ protected boolean deleteSnapshotChain(SnapshotInfo 
snapshot) {
                         }
                     }
                     if (!deleted) {
    -                    boolean r = snapshotSvr.deleteSnapshot(snapshot);
    -                    if (r) {
    -                        // delete snapshot in cache if there is
    -                        List<SnapshotInfo> cacheSnaps = 
snapshotDataFactory.listSnapshotOnCache(snapshot.getId());
    -                        for (SnapshotInfo cacheSnap : cacheSnaps) {
    -                            s_logger.debug("Delete snapshot " + 
snapshot.getId() + " from image cache store: " + 
cacheSnap.getDataStore().getName());
    -                            cacheSnap.delete();
    +                    try {
    +                        boolean r = snapshotSvr.deleteSnapshot(snapshot);
    +                        if (r) {
    +                            // delete snapshot in cache if there is
    +                            List<SnapshotInfo> cacheSnaps = 
snapshotDataFactory.listSnapshotOnCache(snapshot.getId());
    +                            for (SnapshotInfo cacheSnap : cacheSnaps) {
    +                                s_logger.debug("Delete snapshot " + 
snapshot.getId() + " from image cache store: " + 
cacheSnap.getDataStore().getName());
    +                                cacheSnap.delete();
    +                            }
                             }
    -                    }
    -                    if (!resultIsSet) {
    -                        result = r;
    -                        resultIsSet = true;
    +                        if (!resultIsSet) {
    +                            result = r;
    +                            resultIsSet = true;
    +                        }
    +                    } catch (Exception e){
    --- End diff --
    
    Can you put a comment here as well as to why there is catch all so that the 
intent is clear? Also there are some minor formatting issues, please fix them.


> Retry deleting snapshot if deleteSnapshot command failed 
> ---------------------------------------------------------
>
>                 Key: CLOUDSTACK-9706
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9706
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>            Reporter: Anshul Gangwar
>            Assignee: Anshul Gangwar
>
> Currently when we delete snapshot then we mark it to be in destroyed state 
> first and then we go to delete it on storage if it can be deleted. If the 
> deletion of snapshot fails then we never retry to delete it which fills up 
> storage.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to