From a9cf95ce04f9a9ab62bcb156dc860c31630b6892 Mon Sep 17 00:00:00 2001 From: Slavka Peleva Date: Fri, 4 Apr 2025 12:07:09 +0300 Subject: [PATCH] Fix the size of a template downloaded from secondary storage 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 c04538271a1d..18d924bcd522 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 void copyAsync(DataObject srcData, DataObject dstData, AsyncCompletionCal 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 @@ private Answer createVolumeSnapshot(StorageSubSystemCommand cmd, Long size, SpCo } else { dstTO.setPath(StorPoolUtil.devPath( StorPoolUtil.getSnapshotNameFromResponse(resp, false, StorPoolUtil.GLOBAL_ID))); - dstTO.setSize(size); answer = new CopyCmdAnswer(dstTO); } return answer;