[pve-devel] [PATCH qemu-server 01/31] print ovmf commandline: collect hardware parameters into hash argument

Fiona Ebner f.ebner at proxmox.com
Wed Jun 25 17:56:24 CEST 2025


Also avoids querying the AMD-SEV type again, inside the function.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 src/PVE/QemuServer.pm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 63b4d469..6926182b 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -3465,11 +3465,12 @@ my sub should_disable_smm {
 }
 
 my sub print_ovmf_drive_commandlines {
-    my ($conf, $storecfg, $vmid, $arch, $q35, $version_guard) = @_;
+    my ($conf, $storecfg, $vmid, $hw_info, $version_guard) = @_;
+
+    my ($amd_sev_type, $arch, $q35) = $hw_info->@{qw(amd-sev-type arch q35)};
 
     my $d = $conf->{efidisk0} ? parse_drive('efidisk0', $conf->{efidisk0}) : undef;
 
-    my $amd_sev_type = get_amd_sev_type($conf);
     die "Attempting to configure SEV-SNP with pflash devices instead of using `-bios`\n"
         if $amd_sev_type && $amd_sev_type eq 'snp';
 
@@ -3690,8 +3691,13 @@ sub config_to_command {
             }
             push $cmd->@*, '-bios', get_ovmf_files($arch, undef, undef, $amd_sev_type);
         } else {
+            my $hw_info = {
+                'amd-sev-type' => $amd_sev_type,
+                arch => $arch,
+                q35 => $q35,
+            };
             my ($code_drive_str, $var_drive_str) =
-                print_ovmf_drive_commandlines($conf, $storecfg, $vmid, $arch, $q35, $version_guard);
+                print_ovmf_drive_commandlines($conf, $storecfg, $vmid, $hw_info, $version_guard);
             push $cmd->@*, '-drive', $code_drive_str;
             push $cmd->@*, '-drive', $var_drive_str;
         }
-- 
2.47.2





More information about the pve-devel mailing list