From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id D5E641FF0A7 for ; Wed, 19 Aug 2026 18:37:38 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 7819F2157A; Wed, 19 Aug 2026 18:37:29 +0200 (CEST) Message-ID: <9680a64f-0a1f-4db0-8da4-3e9921ea27fd@proxmox.com> Date: Wed, 19 Aug 2026 18:37:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 qemu-server 3/5] helpers: add helper for min package version comparison To: Christian Ebner , pve-devel@lists.proxmox.com References: <20260819144642.453513-1-c.ebner@proxmox.com> <20260819144642.453513-4-c.ebner@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: <20260819144642.453513-4-c.ebner@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1787157418431 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.864 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: DLSYJF4Z3ZDG66Q3SASP27UXVVO7QYZR X-Message-ID-Hash: DLSYJF4Z3ZDG66Q3SASP27UXVVO7QYZR X-MailFrom: f.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Am 19.08.26 um 4:46 PM schrieb Christian Ebner: > To be used for checking the minimum version of qemu-kvm package > version, where the binary version check is not enough to detect > versions having the pbs-restore `no-cache` flag. > > Signed-off-by: Christian Ebner > --- > changes: > - new in version 2 > > src/PVE/QemuServer/Helpers.pm | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/src/PVE/QemuServer/Helpers.pm b/src/PVE/QemuServer/Helpers.pm > index 658400f2..860c0a9c 100644 > --- a/src/PVE/QemuServer/Helpers.pm > +++ b/src/PVE/QemuServer/Helpers.pm > @@ -21,6 +21,7 @@ our @EXPORT_OK = qw( > parse_number_sets > windows_version > get_host_arch > + min_package_version > ); > > my $nodename = PVE::INotify::nodename(); > @@ -89,6 +90,19 @@ sub kvm_user_version { > return $kvm_user_version->{$binary}->{$version_type}; > } > > +sub min_package_version { I'd rather have the helper be binary_package_version_at_least() and take the $binary instead of $verstr. It can call kvm_user_version itself. Then there is less potential for somebody to pass along the wrong kind of version. > + my ($verstr, $major, $minor, $patch, $subver, $rel) = @_; s/$patch/$micro/ No need for $subver, see the previous patch > + > + if ($verstr =~ m/^(\d+)\.(\d+)(?:\.(\d+))?(?:\.(\d+))?-(\d+)/) { > + return 1 > + if version_cmp($1, $major, $2, $minor, $3 // 0, $patch, $4 // 0, $subver, $5, $rel) >= > + 0; Style nit: multi-line post-if > + return 0; > + } > + > + die "internal error: cannot check version of invalid string '$verstr'"; > +} > + > # Paths and directories > > # FIXME: MAJOR VERSION: use /run/qemu-server everywhere instead of mixing /run and /var/run and rely