From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id 3BB921FF2CA
	for <inbox@lore.proxmox.com>; Tue, 23 Jul 2024 17:25:39 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id AFAC86878;
	Tue, 23 Jul 2024 17:25:57 +0200 (CEST)
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Tue, 23 Jul 2024 17:25:45 +0200
Message-Id: <20240723152548.129832-8-f.ebner@proxmox.com>
X-Mailer: git-send-email 2.39.2
In-Reply-To: <20240723152548.129832-1-f.ebner@proxmox.com>
References: <20240723152548.129832-1-f.ebner@proxmox.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.061 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pve-devel] [PATCH qemu-server 07/10] cfg2cmd: drop superfluous
 check for QEMU binary version 4.1
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

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@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel