From c2f1e06ab93c57bc28624ca5d02e595a5149c03c Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Tue, 23 Jul 2024 17:25:45 +0200 Subject: [PATCH] cfg2cmd: drop superfluous check for QEMU binary version 4.1 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 Reviewed-by: Daniel Kral Tested-by: Daniel Kral --- PVE/QemuServer.pm | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index e2c073d1..6af75701 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -3313,7 +3313,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}; @@ -3328,13 +3328,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; @@ -3619,9 +3617,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); @@ -4168,10 +4164,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);