sureshanaparti commented on code in PR #8575:
URL: https://github.com/apache/cloudstack/pull/8575#discussion_r1472907496
##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java:
##########
@@ -846,6 +791,42 @@ public void copyAsync(DataObject srcData, DataObject
dstData, AsyncCompletionCal
callback.complete(res);
}
+ private Answer createVolumeSnapshot(StorageSubSystemCommand cmd, Long
size, SpConnectionDesc conn,
+ String volName, TemplateObjectTO dstTO) {
+ Answer answer;
+ SpApiResponse resp2 = StorPoolUtil.volumeSnapshot(volName,
dstTO.getUuid(), null, "template", null, conn);
+ if (resp2.getError() != null) {
+ answer = new Answer(cmd, false, String.format("Could not snapshot
volume. Error: %s", resp2.getError()));
+ } else {
+ dstTO.setPath(StorPoolUtil.devPath(
+ StorPoolUtil.getSnapshotNameFromResponse(resp2, false,
StorPoolUtil.GLOBAL_ID)));
+ dstTO.setSize(size);
+ answer = new CopyCmdAnswer(dstTO);
+ }
+ return answer;
+ }
+
+ private Answer createVolumeFromSnapshot(DataObject srcData, DataObject
dstData, final Long size,
+ SpApiResponse emptyVolumeCreateResp) {
+ Answer answer;
+ String name = StorPoolUtil.getNameFromResponse(emptyVolumeCreateResp,
false);
+ VolumeObjectTO dstTO = (VolumeObjectTO) dstData.getTO();
+ dstTO.setSize(size);
+ dstTO.setPath(StorPoolUtil.devPath(name));
+ StorageSubSystemCommand cmd1 = new
StorPoolDownloadTemplateCommand(srcData.getTO(), dstTO,
StorPoolHelper.getTimeout(StorPoolHelper.PrimaryStorageDownloadWait,
configDao), VirtualMachineManager.ExecuteInSequence.value(), "volume");
Review Comment:
```suggestion
StorageSubSystemCommand cmd = new
StorPoolDownloadTemplateCommand(srcData.getTO(), dstTO,
StorPoolHelper.getTimeout(StorPoolHelper.PrimaryStorageDownloadWait,
configDao), VirtualMachineManager.ExecuteInSequence.value(), "volume");
```
--
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]