[pve-devel] [PATCH qemu-server 12/15] cfg2cmd: ovmf: support print_ovmf_commandline() returning machine flags

Fiona Ebner f.ebner at proxmox.com
Mon Jun 23 17:44:22 CEST 2025


This is in preparation for the switch to -blockdev, where it will be
necessary to specify the 'pflash0' and 'pflash1' machine flags.

Suggested-by: Alexandre Derumier <alexandre.derumier at groupe-cyllene.com>
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 src/PVE/QemuServer.pm      | 3 ++-
 src/PVE/QemuServer/OVMF.pm | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 719687dc..4edd1793 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -3574,10 +3574,11 @@ sub config_to_command {
     }
 
     if ($conf->{bios} && $conf->{bios} eq 'ovmf') {
-        my $ovmf_cmd = PVE::QemuServer::OVMF::print_ovmf_commandline(
+        my ($ovmf_cmd, $ovmf_machine_flags) = PVE::QemuServer::OVMF::print_ovmf_commandline(
             $conf, $storecfg, $vmid, $arch, $q35, $version_guard, $forcecpu,
         );
         push $cmd->@*, $ovmf_cmd->@*;
+        push $machineFlags->@*, $ovmf_machine_flags->@*;
     }
 
     if ($q35) { # tell QEMU to load q35 config early
diff --git a/src/PVE/QemuServer/OVMF.pm b/src/PVE/QemuServer/OVMF.pm
index 5c0d8b53..8b28f902 100644
--- a/src/PVE/QemuServer/OVMF.pm
+++ b/src/PVE/QemuServer/OVMF.pm
@@ -216,6 +216,7 @@ sub print_ovmf_commandline {
     my ($conf, $storecfg, $vmid, $arch, $q35, $version_guard, $forcecpu) = @_;
 
     my $cmd = [];
+    my $machine_flags = [];
 
     die "OVMF (UEFI) BIOS is not supported on 32-bit CPU types\n"
         if !$forcecpu && get_cpu_bitness($conf->{cpu}, $arch) == 32;
@@ -233,7 +234,7 @@ sub print_ovmf_commandline {
         push $cmd->@*, '-drive', $var_drive_str;
     }
 
-    return $cmd;
+    return ($cmd, $machine_flags);
 }
 
 1;
-- 
2.47.2





More information about the pve-devel mailing list