slavkap commented on pull request #5544:
URL: https://github.com/apache/cloudstack/pull/5544#issuecomment-932694299


   @DaanHoogland, thanks for the review! If you ask me, the right solution is 
first to check if the snapshot is on the primary storage and, if it's not 
there, to check on secondary. From what I saw in all of the storage plugins, 
the snapshots are kept on primary storage always. For me checking the value of 
`snapshot.backup.to.secondary` is just a limitation. I think that this method 
should be modified or removed:
   
   >      private DataStoreRole getDataStoreRole(Snapshot snapshot, 
SnapshotDataStoreDao snapshotStoreDao, DataStoreManager dataStoreMgr) {
   >         SnapshotDataStoreVO snapshotStore = 
snapshotStoreDao.findBySnapshot(snapshot.getId(), DataStoreRole.Primary);
   > 
   >         if (snapshotStore == null) {
   >             return DataStoreRole.Image;
   >         }
   > 
   >         long storagePoolId = snapshotStore.getDataStoreId();
   >         DataStore dataStore = dataStoreMgr.getDataStore(storagePoolId, 
DataStoreRole.Primary);
   > 
   >         Map<String, String> mapCapabilities = 
dataStore.getDriver().getCapabilities();
   > 
   >         if (mapCapabilities != null) {
   >             String value = 
mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
   >             Boolean supportsStorageSystemSnapshots = new Boolean(value);
   > 
   >             if (supportsStorageSystemSnapshots) {
   >                 return DataStoreRole.Primary;
   >             }
   >         }
   > 
   >         StoragePoolVO storagePoolVO = 
_storagePoolDao.findById(storagePoolId);
   >         if (storagePoolVO.getPoolType() == StoragePoolType.RBD && 
!BackupSnapshotAfterTakingSnapshot.value()) {
   >             return DataStoreRole.Primary;
   >         }
   > 
   >         return DataStoreRole.Image;
   >     }


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