[pve-devel] [PATCH v13 qemu-server 4/8] clone disk: also clone EFI disk from snapshot

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Apr 4 16:58:19 CEST 2022


On March 17, 2022 12:31 pm, Fabian Ebner wrote:
> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
> ---
> 
> New in v13.
> 
> Dependency bump for QEMU 6.2 needed for qemu-img dd's -l option.

as discussed off-list - I'd prefer to version-guard the adding of the 
`-l` part for a while, it's already conditional, and we probably want 
users encountering issues with 6.2 to be able to downgrade to 6.1 ;)

likely bumping the versioned dep to 6 might be a good idea in any case?

> 
>  PVE/QemuServer.pm | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 907cfc09..a24309d2 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -7662,14 +7662,18 @@ sub clone_disk {
>  		# the relevant data on the efidisk may be smaller than the source
>  		# e.g. on RBD/ZFS, so we use dd to copy only the amount
>  		# that is given by the OVMF_VARS.fd
> -		my $src_path = PVE::Storage::path($storecfg, $drive->{file});
> +		my $src_path = PVE::Storage::path($storecfg, $drive->{file}, $snapname);
>  		my $dst_path = PVE::Storage::path($storecfg, $newvolid);
>  
> +		my $src_format = (PVE::Storage::parse_volname($storecfg, $drive->{file}))[6];
> +
>  		# better for Ceph if block size is not too small, see bug #3324
>  		my $bs = 1024*1024;
>  
> -		run_command(['qemu-img', 'dd', '-n', '-O', $dst_format, "bs=$bs", "osize=$size",
> -		    "if=$src_path", "of=$dst_path"]);
> +		my $cmd = ['qemu-img', 'dd', '-n', '-O', $dst_format];
> +		push $cmd->@*, '-l', $snapname if $src_format eq 'qcow2' && $snapname;
> +		push $cmd->@*, "bs=$bs", "osize=$size", "if=$src_path", "of=$dst_path";
> +		run_command($cmd);
>  	    } else {
>  		qemu_img_convert($drive->{file}, $newvolid, $size, $snapname, $sparseinit);
>  	    }
> -- 
> 2.30.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 





More information about the pve-devel mailing list