]> git.proxmox.com Git - qemu-server.git/commitdiff
clone disk: add version guard for qemu-img dd's -l option
authorFabian Ebner <f.ebner@proxmox.com>
Tue, 5 Apr 2022 08:22:14 +0000 (10:22 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 6 Apr 2022 15:41:49 +0000 (17:41 +0200)
It's only available since QEMU 6.2 and doing a check here rather than
bumping the package dependency allows for easy downgrades.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/QemuServer.pm

index eb2db42a127b338a1e24f5f79477adb6adcf8e72..d7f4befc66ea8a70c050f6a23a258afecce6a2a9 100644 (file)
@@ -7708,7 +7708,12 @@ sub clone_disk {
                my $bs = 1024*1024;
 
                my $cmd = ['qemu-img', 'dd', '-n', '-O', $dst_format];
-               push $cmd->@*, '-l', $snapname if $src_format eq 'qcow2' && $snapname;
+
+               if ($src_format eq 'qcow2' && $snapname) {
+                   die "cannot clone qcow2 EFI disk snapshot - requires QEMU >= 6.2\n"
+                       if !min_version(kvm_user_version(), 6, 2);
+                   push $cmd->@*, '-l', $snapname;
+               }
                push $cmd->@*, "bs=$bs", "osize=$size", "if=$src_path", "of=$dst_path";
                run_command($cmd);
            } else {