[pve-devel] [PATCH qemu-server v2 4/4] ovmf: deprecate old legay ovmf image and refactor
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Aug 28 10:37:45 CEST 2017
this was only kept for PVE 4.X where the switch to the newer OVMF
image with actual working persisten EFIVARS was made.
We do not ship this old image in PVE 5.0 anymore so remove this
legacy code as it can never trigger anyhow.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
changes v1 -> v2:
* fix check if $OVMF_CODE exists
* remove $ovmfbase variable, its set to $OVMF_CODE allways anyway
* move check if efidisk in foreach_drive up so that we return early if nothing
must be done
PVE/QemuServer.pm | 48 +++++++++++++-----------------------------------
1 file changed, 13 insertions(+), 35 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index b716491..c9b7652 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -39,7 +39,6 @@ use URI::Escape;
my $OVMF_CODE = '/usr/share/kvm/OVMF_CODE-pure-efi.fd';
my $OVMF_VARS = '/usr/share/kvm/OVMF_VARS-pure-efi.fd';
-my $OVMF_IMG = '/usr/share/kvm/OVMF-pure-efi.fd';
my $qemu_snap_storage = {rbd => 1, sheepdog => 1};
@@ -2878,44 +2877,25 @@ sub config_to_command {
}
if ($conf->{bios} && $conf->{bios} eq 'ovmf') {
- my $ovmfbase;
+ die "uefi base image not found\n" if ! -f $OVMF_CODE;
- # prefer the OVMF_CODE variant
- if (-f $OVMF_CODE) {
- $ovmfbase = $OVMF_CODE;
- } elsif (-f $OVMF_IMG) {
- $ovmfbase = $OVMF_IMG;
- }
-
- die "no uefi base img found\n" if !$ovmfbase;
- push @$cmd, '-drive', "if=pflash,unit=0,format=raw,readonly,file=$ovmfbase";
-
- if (defined($conf->{efidisk0}) && ($ovmfbase eq $OVMF_CODE)) {
- my $d = PVE::JSONSchema::parse_property_string($efidisk_fmt, $conf->{efidisk0});
- my $format = $d->{format} // 'raw';
- my $path;
+ my $path;
+ 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);
if ($storeid) {
$path = PVE::Storage::path($storecfg, $d->{file});
- my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
- $format = qemu_img_format($scfg, $volname);
} else {
$path = $d->{file};
- $format = "raw";
}
- push @$cmd, '-drive', "if=pflash,unit=1,id=drive-efidisk0,format=$format,file=$path";
- } elsif ($ovmfbase eq $OVMF_CODE) {
- warn "using uefi without permanent efivars disk\n";
- my $ovmfvar_dst = "/tmp/$vmid-ovmf.fd";
- PVE::Tools::file_copy($OVMF_VARS, $ovmfvar_dst, 256*1024);
- push @$cmd, '-drive', "if=pflash,unit=1,format=raw,file=$ovmfvar_dst";
} else {
- # if the base img is not OVMF_CODE, we do not have to bother
- # to create/use a vars image, since it will not be used anyway
- # this can only happen if someone manually deletes the OVMF_CODE image
- # or has an old pve-qemu-kvm version installed.
- # both should not happen, but we ignore it here
+ warn "no efidisk configured! Using temporary efivars disk.\n";
+ $path = "/tmp/$vmid-ovmf.fd";
+ PVE::Tools::file_copy($OVMF_VARS, $path, -s $OVMF_VARS);
}
+
+ 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";
}
@@ -3243,6 +3223,9 @@ sub config_to_command {
push @$vollist, $drive->{file};
}
+ # ignore efidisk here, already added in bios/fw handling code above
+ return if $drive->{interface} eq 'efidisk';
+
$use_virtio = 1 if $ds =~ m/^virtio/;
if (drive_is_cdrom ($drive)) {
@@ -3292,11 +3275,6 @@ sub config_to_command {
$ahcicontroller->{$controller}=1;
}
- if ($drive->{interface} eq 'efidisk') {
- # this will be added somewhere else
- return;
- }
-
my $drive_cmd = print_drive_full($storecfg, $vmid, $drive);
push @$devices, '-drive',$drive_cmd;
push @$devices, '-device', print_drivedevice_full($storecfg, $conf, $vmid, $drive, $bridges);
--
2.11.0
More information about the pve-devel
mailing list