[pve-devel] [PATCH qemu-server] fix efi disk format detection

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Jan 8 15:10:37 CET 2018


On 12/28/17 2:33 PM, Wolfgang Bumiller wrote:
> Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
> Fixes: 2bfbee039bbe ("include format for efidisk")
> ---
>  PVE/QemuServer.pm | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 42c412a..4837331 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2908,20 +2908,26 @@ sub config_to_command {
>  	die "uefi base image not found\n" if ! -f $OVMF_CODE;
>  
>  	my $path;
> -	my $format = 'raw';
> +	my $format;
>  	if (my $efidisk = $conf->{efidisk0}) {
>  	    my $d = PVE::JSONSchema::parse_property_string($efidisk_fmt, $efidisk);
>  	    my ($storeid, $volname) = PVE::Storage::parse_volume_id($d->{file}, 1);
> +	    $format = $d->{format};
>  	    if ($storeid) {
>  		$path = PVE::Storage::path($storecfg, $d->{file});
> +		if (!defined($format)) {
> +		    my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
> +		    $format = qemu_img_format($scfg, $volname);
> +		}
>  	    } else {
>  		$path = $d->{file};
> +		$format //= 'raw';

This case also needs the format detection, else you get a blocked guest
(display not yet initialized) if the disk is not raw.

We could also require that format must be specified in the path case and
just die here with a helpful message.

>  	    }
> -	    $format = $d->{format} if $d->{format};
>  	} else {
>  	    warn "no efidisk configured! Using temporary efivars disk.\n";
>  	    $path = "/tmp/$vmid-ovmf.fd";
>  	    PVE::Tools::file_copy($OVMF_VARS, $path, -s $OVMF_VARS);
> +	    $format = 'raw';
>  	}
>  
>  	push @$cmd, '-drive', "if=pflash,unit=0,format=raw,readonly,file=$OVMF_CODE";
> 





More information about the pve-devel mailing list