[pve-devel] [PATCH qemu-server 07/10] cfg2cmd: drop superfluous check for QEMU binary version 4.1

Fiona Ebner f.ebner at proxmox.com
Tue Jul 23 17:25:45 CEST 2024


The minimum supported version for Proxmox VE 8 nodes is QEMU 8.0 and
the beginning of the config_to_command() function already has a check
for at least version 5.0. No other caller of get_vm_machine() passes
in the parameter, so it can be removed from there as well.

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

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 39b33438..5331ec53 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3253,7 +3253,7 @@ sub windows_get_pinned_machine_version {
 }
 
 sub get_vm_machine {
-    my ($conf, $forcemachine, $arch, $add_pve_version) = @_;
+    my ($conf, $forcemachine, $arch) = @_;
 
     my $machine_conf = PVE::QemuServer::Machine::parse_machine($conf->{machine});
     my $machine = $forcemachine || $machine_conf->{type};
@@ -3268,13 +3268,11 @@ sub get_vm_machine {
 	}
 	$arch //= 'x86_64';
 	$machine ||= $default_machines->{$arch};
-	if ($add_pve_version) {
-	    my $pvever = PVE::QemuServer::Machine::get_pve_version($kvmversion);
-	    $machine .= "+pve$pvever";
-	}
+	my $pvever = PVE::QemuServer::Machine::get_pve_version($kvmversion);
+	$machine .= "+pve$pvever";
     }
 
-    if ($add_pve_version && $machine !~ m/\+pve\d+?(?:\.pxe)?$/) {
+    if ($machine !~ m/\+pve\d+?(?:\.pxe)?$/) {
 	my $is_pxe = $machine =~ m/^(.*?)\.pxe$/;
 	$machine = $1 if $is_pxe;
 
@@ -3559,9 +3557,7 @@ sub config_to_command {
 	die "Detected old QEMU binary ('$kvmver', at least 5.0 is required)\n";
     }
 
-    my $add_pve_version = min_version($kvmver, 4, 1);
-
-    my $machine_type = get_vm_machine($conf, $forcemachine, $arch, $add_pve_version);
+    my $machine_type = get_vm_machine($conf, $forcemachine, $arch);
     my $machine_version = extract_version($machine_type, $kvmver);
     $kvm //= 1 if is_native_arch($arch);
 
@@ -4108,10 +4104,8 @@ sub config_to_command {
     push @$machineFlags, 'smm=off' if should_disable_smm($conf, $vga, $machine_type);
 
     my $machine_type_min = $machine_type;
-    if ($add_pve_version) {
-	$machine_type_min =~ s/\+pve\d+$//;
-	$machine_type_min .= "+pve$required_pve_version";
-    }
+    $machine_type_min =~ s/\+pve\d+$//;
+    $machine_type_min .= "+pve$required_pve_version";
     push @$machineFlags, "type=${machine_type_min}";
 
     PVE::QemuServer::Machine::assert_valid_machine_property($conf, $machine_conf);
-- 
2.39.2





More information about the pve-devel mailing list