From f6f33c6add3f6f947716fef46e6e9a4a491ee359 Mon Sep 17 00:00:00 2001 From: slavkap <51903378+slavkap@users.noreply.github.com> Date: Wed, 23 Apr 2025 13:37:47 +0300 Subject: [PATCH] Fix the size of a template downloaded from secondary storage (#10662) Fixing the size of a template that is downloaded from secondary storage to StorPool --- .../datastore/driver/StorPoolPrimaryDataStoreDriver.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java index c04538271a1..18d924bcd52 100644 --- a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java +++ b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java @@ -776,7 +776,8 @@ public class StorPoolPrimaryDataStoreDriver implements PrimaryDataStoreDriver { if (answer != null && answer.getResult()) { // successfully downloaded template to primary storage - answer = createVolumeSnapshot(cmd, size, conn, volName, dstTO); + TemplateObjectTO templ = (TemplateObjectTO) ((CopyCmdAnswer) answer).getNewData(); + answer = createVolumeSnapshot(cmd, size, conn, volName, templ); } else { err = answer != null ? answer.getDetails() : "Unknown error while downloading template. Null answer returned."; } @@ -983,7 +984,6 @@ public class StorPoolPrimaryDataStoreDriver implements PrimaryDataStoreDriver { } else { dstTO.setPath(StorPoolUtil.devPath( StorPoolUtil.getSnapshotNameFromResponse(resp, false, StorPoolUtil.GLOBAL_ID))); - dstTO.setSize(size); answer = new CopyCmdAnswer(dstTO); } return answer;