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.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to