[pve-devel] [PATCH qemu-server] include format for efidisk

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Nov 7 07:49:07 CET 2017


On Fri, Nov 03, 2017 at 02:58:41PM +0100, Dominik Csapak wrote:
> if the efidisk is in 'raw' format, qemu will prevent writes
> on block zero if the format is not explicitely given
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  PVE/QemuServer.pm | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 896089f..e7af970 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2901,6 +2901,7 @@ sub config_to_command {
>  	die "uefi base image not found\n" if ! -f $OVMF_CODE;
>  
>  	my $path;
> +	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);
> @@ -2909,6 +2910,7 @@ sub config_to_command {
>  	    } else {
>  		$path = $d->{file};
>  	    }
> +	    $format = $d->{format} // 'raw';
>  	} else {

The else case leaves $format undefined now.

>  	    warn "no efidisk configured! Using temporary efivars disk.\n";
>  	    $path = "/tmp/$vmid-ovmf.fd";
> @@ -2916,7 +2918,7 @@ sub config_to_command {
>  	}
>  
>  	push @$cmd, '-drive', "if=pflash,unit=0,format=raw,readonly,file=$OVMF_CODE";
> -	push @$cmd, '-drive', "if=pflash,unit=1,id=drive-efidisk0,file=$path";
> +	push @$cmd, '-drive', "if=pflash,unit=1,format=$format,id=drive-efidisk0,file=$path";
>      }
>  
>  
> -- 
> 2.11.0




More information about the pve-devel mailing list