You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by we...@apache.org on 2026/08/19 10:47:53 UTC
(cloudstack) 03/03: kvm: execute "qemu-img convert" by Script.executeCommandForExitValue
This is an automated email from the ASF dual-hosted git repository.
weizhouapache pushed a commit to branch 4.23.0-merge-4.22.1.1
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit cd486acc9393986c13497ff3c4504982a14c8fb2
Author: Wei Zhou <we...@apache.org>
AuthorDate: Wed Aug 19 12:46:06 2026 +0200
kvm: execute "qemu-img convert" by Script.executeCommandForExitValue
in additional to the change on LibvirtRestoreBackupCommandWrapper.java
```
api,server,kvm: improve backup repository mount handling
Improves handling of mount options for backup repository.
```
---
.../kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java
index b80f3d54eb4..3839d7f6bdb 100644
--- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java
+++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java
@@ -56,10 +56,6 @@ import com.cloud.vm.VirtualMachine;
public class LibvirtRestoreBackupCommandWrapper extends CommandWrapper<RestoreBackupCommand, Answer, LibvirtComputingResource> {
private static final String BACKUP_TEMP_FILE_PREFIX = "csbackup";
private static final String FILE_PATH_PLACEHOLDER = "%s/%s";
- // Flattens the backing-file chain into a single self-contained qcow2 written to the
- // destination volume path. Used when the source backup is an incremental whose qcow2
- // has a backing reference to its parent (chain set up by nasbackup.sh's qemu-img rebase).
- private static final String QEMU_IMG_FLATTEN_COMMAND = "qemu-img convert -O qcow2 %s %s";
// Detects whether a qcow2 file references a parent in its backing-file metadata.
// Returns 0 (true) when a backing file is present, 1 when not. Uses --output=json
// so the test is robust to qemu-img version differences in human-readable output.
@@ -291,8 +287,8 @@ public class LibvirtRestoreBackupCommandWrapper extends CommandWrapper<RestoreBa
// chain via qemu-img convert, which follows the backing-file links and
// produces a single self-contained qcow2.
if (hasBackingChain(backupPath)) {
- int flattenExit = Script.runSimpleBashScriptForExitValue(
- String.format(QEMU_IMG_FLATTEN_COMMAND, backupPath, volumePath), timeout, false);
+ String[] qemuImgCmd = new String[] { Script.getExecutableAbsolutePath("qemu-img"), "convert", "-O", "qcow2", backupPath, volumePath };
+ int flattenExit = Script.executeCommandForExitValue(qemuImgCmd);
return flattenExit == 0;
}