sureshanaparti commented on code in PR #11490:
URL: https://github.com/apache/cloudstack/pull/11490#discussion_r2291577646


##########
engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java:
##########
@@ -579,19 +579,18 @@ public VolumeInfo createVolumeFromSnapshot(Volume volume, 
Snapshot snapshot, Use
         VolumeInfo vol = volFactory.getVolume(volume.getId());
         long zoneId = volume.getDataCenterId();
         DataStore store = dataStoreMgr.getDataStore(pool.getId(), 
DataStoreRole.Primary);
-        DataStoreRole dataStoreRole = 
snapshotHelper.getDataStoreRole(snapshot);
+        DataStoreRole dataStoreRole = 
snapshotHelper.getDataStoreRole(snapshot, zoneId);
         SnapshotInfo snapInfo = 
snapshotFactory.getSnapshotWithRoleAndZone(snapshot.getId(), dataStoreRole, 
zoneId);
-        boolean kvmSnapshotOnlyInPrimaryStorage = 
snapshotHelper.isKvmSnapshotOnlyInPrimaryStorage(snapshot, dataStoreRole);
+        boolean kvmSnapshotOnlyInPrimaryStorage = 
snapshotHelper.isKvmSnapshotOnlyInPrimaryStorage(snapshot, dataStoreRole, 
zoneId);
         logger.debug("Creating volume from snapshot, with dataStore role {} 
and on primary storage: {}", dataStoreRole, kvmSnapshotOnlyInPrimaryStorage);
 
         boolean storageSupportSnapshotToTemplateEnabled = 
snapshotHelper.isStorageSupportSnapshotToTemplate(snapInfo);
         try {
-            if (storageSupportSnapshotToTemplateEnabled) { // true only for 
StorPool now [TODO: Update to check storage supports snapshot to volume 
(DataStoreCapabilities.CAN_CREATE_VOLUME_FROM_SNAPSHOT) - may impact other 
storages, or StorPool storage type only]
-                dataStoreRole = snapshotHelper.getDataStoreRole(snapshot, 
zoneId);
+            if (!storageSupportSnapshotToTemplateEnabled) { // true only for 
StorPool now [TODO: Update to check storage supports snapshot to volume 
(DataStoreCapabilities.CAN_CREATE_VOLUME_FROM_SNAPSHOT) - may impact other 
storages, or StorPool storage type only]

Review Comment:
   ```suggestion
               if (!storageSupportSnapshotToTemplateEnabled) { // this 
condition is false only for StorPool [TODO: Update to check storage supports 
snapshot to volume (DataStoreCapabilities.CAN_CREATE_VOLUME_FROM_SNAPSHOT) 
later - may impact other storages, or StorPool storage type only]
   ```



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to