Skip to content

Commit cd486ac

Browse files
committed
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. ```
1 parent d7b4f35 commit cd486ac

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@
5656
public class LibvirtRestoreBackupCommandWrapper extends CommandWrapper<RestoreBackupCommand, Answer, LibvirtComputingResource> {
5757
private static final String BACKUP_TEMP_FILE_PREFIX = "csbackup";
5858
private static final String FILE_PATH_PLACEHOLDER = "%s/%s";
59-
// Flattens the backing-file chain into a single self-contained qcow2 written to the
60-
// destination volume path. Used when the source backup is an incremental whose qcow2
61-
// has a backing reference to its parent (chain set up by nasbackup.sh's qemu-img rebase).
62-
private static final String QEMU_IMG_FLATTEN_COMMAND = "qemu-img convert -O qcow2 %s %s";
6359
// Detects whether a qcow2 file references a parent in its backing-file metadata.
6460
// Returns 0 (true) when a backing file is present, 1 when not. Uses --output=json
6561
// so the test is robust to qemu-img version differences in human-readable output.
@@ -291,8 +287,8 @@ private boolean replaceVolumeWithBackup(KVMStoragePoolManager storagePoolMgr, Pr
291287
// chain via qemu-img convert, which follows the backing-file links and
292288
// produces a single self-contained qcow2.
293289
if (hasBackingChain(backupPath)) {
294-
int flattenExit = Script.runSimpleBashScriptForExitValue(
295-
String.format(QEMU_IMG_FLATTEN_COMMAND, backupPath, volumePath), timeout, false);
290+
String[] qemuImgCmd = new String[] { Script.getExecutableAbsolutePath("qemu-img"), "convert", "-O", "qcow2", backupPath, volumePath };
291+
int flattenExit = Script.executeCommandForExitValue(qemuImgCmd);
296292
return flattenExit == 0;
297293
}
298294

0 commit comments

Comments
 (0)