From a9c45bd4a498ff084eeab8eb921eb3c314a7e3c1 Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Tue, 5 Apr 2022 10:22:14 +0200 Subject: [PATCH] clone disk: add version guard for qemu-img dd's -l option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Fabian Ebner --- PVE/QemuServer.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index eb2db42a..d7f4befc 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -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 {