From efea579af77b7f28d9b06c8cb83188d222e6dce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20B=C3=B6ck?= Date: Thu, 21 May 2026 16:38:45 -0300 Subject: [PATCH 1/3] Convert snapshot command timeout from seconds to millisecconds for QemuImg --- .../com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java index 52740cead278..5f771a781798 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java @@ -2061,7 +2061,7 @@ private void convertTheBaseFileToSnapshot(KVMPhysicalDisk baseFile, String snaps QemuImgFile destFile = new QemuImgFile(snapshotPath); destFile.setFormat(PhysicalDiskFormat.QCOW2); - QemuImg q = new QemuImg(wait); + QemuImg q = new QemuImg(wait * 1000); q.convert(srcFile, destFile, options, qemuObjects, qemuImageOpts, null, true); } From 8997913fde2d91c16905408d0bfed37e7cc2491d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20B=C3=B6ck?= Date: Wed, 27 May 2026 16:28:56 -0300 Subject: [PATCH 2/3] Change QemuImg helper timeout type from int to long --- .../main/java/org/apache/cloudstack/utils/qemu/QemuImg.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/qemu/QemuImg.java b/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/qemu/QemuImg.java index bc123b294ce7..48423b7b60b8 100644 --- a/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/qemu/QemuImg.java +++ b/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/qemu/QemuImg.java @@ -55,7 +55,7 @@ public class QemuImg { /* The qemu-img binary. We expect this to be in $PATH */ public String _qemuImgPath = "qemu-img"; private String cloudQemuImgPath = "cloud-qemu-img"; - private int timeout; + private long timeout; private boolean skipZero = false; private boolean noCache = false; private long version; @@ -118,7 +118,7 @@ public static PreallocationType getPreallocationType(final Storage.ProvisioningT * @param skipZeroIfSupported Don't write zeroes to target device during convert, if supported by qemu-img * @param noCache Ensure we flush writes to target disk (useful for block device targets) */ - public QemuImg(final int timeout, final boolean skipZeroIfSupported, final boolean noCache) throws LibvirtException { + public QemuImg(final long timeout, final boolean skipZeroIfSupported, final boolean noCache) throws LibvirtException { if (skipZeroIfSupported) { final Script s = new Script(_qemuImgPath, timeout); s.add("--help"); @@ -148,7 +148,7 @@ public QemuImg(final int timeout, final boolean skipZeroIfSupported, final boole * @param timeout * The timeout of scripts executed by this QemuImg object. */ - public QemuImg(final int timeout) throws LibvirtException, QemuImgException { + public QemuImg(final long timeout) throws LibvirtException, QemuImgException { this(timeout, false, false); } From 6dc2f8ead3e2732353d7c48c7ede7e27d324fe49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20B=C3=B6ck?= Date: Wed, 27 May 2026 17:06:53 -0300 Subject: [PATCH 3/3] Adjust convertion --- .../com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java index 5f771a781798..070a03a23af4 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java @@ -2061,7 +2061,7 @@ private void convertTheBaseFileToSnapshot(KVMPhysicalDisk baseFile, String snaps QemuImgFile destFile = new QemuImgFile(snapshotPath); destFile.setFormat(PhysicalDiskFormat.QCOW2); - QemuImg q = new QemuImg(wait * 1000); + QemuImg q = new QemuImg(wait * 1000L); q.convert(srcFile, destFile, options, qemuObjects, qemuImageOpts, null, true); }