rp- commented on code in PR #13043:
URL: https://github.com/apache/cloudstack/pull/13043#discussion_r3108723403


##########
plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java:
##########
@@ -766,14 +777,37 @@ public boolean canCopy(DataObject srcData, DataObject 
dstData)
         return false;
     }
 
+    private CopyCommandResult copySnapshotToVolume(SnapshotInfo snapshotInfo, 
VolumeInfo volumeInfo) {
+        String errMsg = null;
+        CopyCmdAnswer answer = null;
+        try {
+            StoragePoolVO storagePoolVO = 
_storagePoolDao.findById(snapshotInfo.getDataStore().getId());
+            String rscName = LinstorUtil.RSC_PREFIX + volumeInfo.getUuid();
+            createResourceFromSnapshot(snapshotInfo.getId(), rscName, 
storagePoolVO);
+
+            VolumeObjectTO volumeTO = (VolumeObjectTO) volumeInfo.getTO();
+            volumeTO.setPath(volumeInfo.getUuid());
+            volumeTO.setSize(volumeInfo.getSize());
+            answer = new CopyCmdAnswer(volumeTO);
+        } catch (Exception e) {
+            errMsg = "Failed to create volume from snapshot: " + 
e.getMessage();
+            logger.error(errMsg, e);

Review Comment:
   Here also a CloudRuntimeException should be thrown, otherwise CloudStack 
will not notice something went wrong.



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