From: Christian Ebner <c.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH v3 qemu-server 4/6] helpers: add helper for min kvm package version comparison
Date: Thu, 20 Aug 2026 11:05:26 +0200 [thread overview]
Message-ID: <20260820090528.117853-5-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260820090528.117853-1-c.ebner@proxmox.com>
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 <c.ebner@proxmox.com>
---
changes since version 2:
- adapt helper function name to fit better to codebase and be more
expressive
- call kvm_user_version() from helper itself instead of fetching and
passing the version string, reducing potential misuse.
- drop useless $subver matching
src/PVE/QemuServer/Helpers.pm | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/PVE/QemuServer/Helpers.pm b/src/PVE/QemuServer/Helpers.pm
index 8047d9e6..5065a457 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
+ binary_package_version_at_least
);
my $nodename = PVE::INotify::nodename();
@@ -91,6 +92,18 @@ sub kvm_user_version {
return 'unknown';
}
+sub binary_package_version_at_least {
+ my ($major, $minor, $micro, $rel, $binary) = @_;
+
+ my $package_version_str = kvm_user_version($binary, 1);
+ if ($package_version_str =~ m/^(\d+)\.(\d+)(?:\.(\d+))?-(\d+)/) {
+ return 1 if version_cmp($1, $major, $2, $minor, $3 // 0, $micro, $4, $rel) >= 0;
+ return 0;
+ }
+
+ die "internal error: cannot check version of invalid string '$package_version_str'";
+}
+
# Paths and directories
# FIXME: MAJOR VERSION: use /run/qemu-server everywhere instead of mixing /run and /var/run and rely
--
2.47.3
next prev parent reply other threads:[~2026-08-20 9:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 9:05 [PATCH v3 pve-qemu qemu-server 0/6] bypass host page cache for restore on zvol Christian Ebner
2026-08-20 9:05 ` [PATCH v3 pve-qemu 1/1] pbs-restore: add optional no-cache flag to bypass host page cache Christian Ebner
2026-08-20 9:05 ` [PATCH v3 qemu-server 2/6] helpers: never cache `unknown` on failed kvm binary version check Christian Ebner
2026-08-20 9:05 ` [PATCH v3 qemu-server 3/6] helpers: optionally get package version for kvm_user_version() Christian Ebner
2026-08-20 9:05 ` Christian Ebner [this message]
2026-08-20 9:05 ` [PATCH v3 qemu-server 5/6] pbs-restore: set 'no-cache' on block devices backed by zfspool Christian Ebner
2026-08-20 9:05 ` [PATCH v3 qemu-server 6/6] vma restore: skip page cache " Christian Ebner
2026-08-20 9:56 ` [PATCH v3 pve-qemu qemu-server 0/6] bypass host page cache for restore on zvol Lukas Sichert
2026-08-20 12:07 ` Thomas Lamprecht
2026-08-20 12:36 ` Christian Ebner
2026-08-20 11:36 ` Lukas Sichert
2026-08-20 13:12 ` Christian Ebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260820090528.117853-5-c.ebner@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.