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

Dominik Csapak d.csapak at proxmox.com
Fri Nov 3 14:58:41 CET 2017


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 {
 	    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