Currently, cloning an EFI disk off a snapshot-as-volume-chain snapshot fails with "qemu-img: Failed to load snapshot: Can't find snapshot". The reason is that the special case for EFI disks calls `qemu-img dd` with the additional `-l snapname` option, which is only valid for qcow2-internal snapshots. For snapshot-as-volume-chain snapshots, the source volume is already the volume corresponding to the snapshot.
Fix this by checking the snapshot method of the volume in question, and only adding the `-l` option if the volume uses qcow2-internal snapshots. Reported in enterprise support. Signed-off-by: Friedrich Weber <[email protected]> --- Notes: Reproducer (STORAGE having snapshot-as-volume-chain enabled): qm create 100 --bios ovmf --efidisk0 STORAGE:1,format=qcow2 qm snapshot 100 mysnap qm clone 100 101 --snap mysnap The rfc used volume_snapshot_info, but this seems to be somewhat buggy and the fix might be more involed (see rfc). I did not have time to look into fixing volume_snapshot_info -- since using volume_qemu_snapshot_method here also sounds appropriate and should fix the bug, I'm sending this new version here. changes since rfc: - check PVE::Storage::volume_qemu_snapshot_method instead of volume_snapshot_info rfc: https://lore.proxmox.com/pve-devel/[email protected]/ src/PVE/QemuServer.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm index cf195ccc..3ea3236c 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -7868,7 +7868,11 @@ sub clone_disk { 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; + + my $method = + PVE::Storage::volume_qemu_snapshot_method($storecfg, $drive->{file}); + # in case of snapshot-as-volume-chain, $src_path points to the snapshot volume + push $cmd->@*, '-l', $snapname if $method eq 'qemu'; } push $cmd->@*, "bs=$bs", "osize=$size", "if=$src_path", "of=$dst_path"; run_command($cmd); -- 2.47.3 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
