You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/02/14 06:29:21 UTC

[GitHub] [cloudstack] GabrielBrascher opened a new pull request #3649: Garbage snapshots are left on Primary and Secondary

GabrielBrascher opened a new pull request #3649: Garbage snapshots are left on Primary and Secondary
URL: https://github.com/apache/cloudstack/pull/3649
 
 
   ## Description
   <!--- Describe your changes in detail -->
   
   Tested both cases:
   - Snapshot backed up on Secondary (stored on primary and secondary) 
   - Snapshot stored only on primary storage.
   
   This fix works for KVM  and XenServer.
   
   **Note**: I changed the name of the strategy from _XenserverSnapshotStrategy_ to _DefaultSnapshotStrategy_ due to the fact that the "Xenserver" strategy handles also Ceph, KVM, and do return `StrategyPriority.DEFAULT` in any case except _REVERT_.
   
   ```
       @Override
       public StrategyPriority canHandle(Snapshot snapshot, SnapshotOperation op) {
           if (SnapshotOperation.REVERT.equals(op)) {
               long volumeId = snapshot.getVolumeId();
               VolumeVO volumeVO = volumeDao.findById(volumeId);
   
               if (volumeVO != null && ImageFormat.QCOW2.equals(volumeVO.getFormat())) {
                   return StrategyPriority.DEFAULT;
               }
               return StrategyPriority.CANT_HANDLE;
           }
           return StrategyPriority.DEFAULT;
       }
   ```
   
   Fixes: #3646
   
   ## Types of changes
   <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services