DaanHoogland commented on code in PR #8067:
URL: https://github.com/apache/cloudstack/pull/8067#discussion_r1358109010


##########
plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java:
##########
@@ -821,12 +1050,21 @@ public void takeSnapshot(SnapshotInfo snapshotInfo, 
AsyncCompletionCallback<Crea
                 result.setResult(errMsg);
             } else
             {
-                s_logger.info(String.format("Successfully took snapshot from 
%s", rscName));
+                s_logger.info(String.format("Successfully took snapshot %s 
from %s", snapshot.getName(), rscName));
+
+                SnapshotObjectTO snapshotTO = 
(SnapshotObjectTO)snapshotInfo.getTO();
+                com.linbit.linstor.api.model.StoragePool linStoragePool = 
LinstorUtil.getDiskfulStoragePool(api, rscName);
+                if (linStoragePool == null) {
+                    throw new CloudRuntimeException("Linstor: Unable to find 
storage pool for resource " + rscName);
+                }
 
-                SnapshotObjectTO snapshotObjectTo = 
(SnapshotObjectTO)snapshotInfo.getTO();
-                snapshotObjectTo.setPath(rscName + "-" + 
snapshotInfo.getName());
+                final String path = 
LinstorUtil.getSnapshotPath(linStoragePool, rscName, LinstorUtil.RSC_PREFIX + 
snapshotInfo.getUuid());
+                snapshotTO.setPath(path);
+                SnapshotDetailsVO details = new SnapshotDetailsVO(
+                    snapshotInfo.getId(), snapshotInfo.getUuid(), path, false);
+                _snapshotDetailsDao.persist(details);
 
-                result = new CreateCmdResult(null, new 
CreateObjectAnswer(snapshotObjectTo));
+                result = new CreateCmdResult(null, new 
CreateObjectAnswer(snapshotTO));
                 result.setResult(null);

Review Comment:
   can you extract this?



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