From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server] tree-wide: properly adapt all version_cmp() calls to moved helper
Date: Tue, 3 Nov 2026 10:48:41 +0100 [thread overview]
Message-ID: <20261103095100.41582-1-f.ebner@proxmox.com> (raw)
While commit 47c17885 ("helpers: drop local version helpers in favor
of pve-common") works, because it explicitly imports version_cmp into
the QemuServer::Helpers module, its intention is to switch over the
helpers. Avoid the indirection as well as the duplicate PVE::Tools
include in the QemuServer::Helpers module.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/QemuServer/Drive.pm | 3 +--
src/PVE/QemuServer/Helpers.pm | 1 -
src/PVE/QemuServer/Machine.pm | 13 +++++--------
src/PVE/QemuServer/QMPHelpers.pm | 4 +++-
4 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/PVE/QemuServer/Drive.pm b/src/PVE/QemuServer/Drive.pm
index 0ca3d636..8b980650 100644
--- a/src/PVE/QemuServer/Drive.pm
+++ b/src/PVE/QemuServer/Drive.pm
@@ -845,8 +845,7 @@ sub virtio_win_iso_issue {
my $cmp_with = sub {
my ($other) = @_;
- return PVE::QemuServer::Helpers::version_cmp(map { ($version[$_], $other->[$_]) }
- 0 .. 2);
+ return PVE::Tools::version_cmp(map { ($version[$_], $other->[$_]) } 0 .. 2);
};
for my $issue ($virtio_win_issues->@*) {
diff --git a/src/PVE/QemuServer/Helpers.pm b/src/PVE/QemuServer/Helpers.pm
index cead2011..ecd1944f 100644
--- a/src/PVE/QemuServer/Helpers.pm
+++ b/src/PVE/QemuServer/Helpers.pm
@@ -11,7 +11,6 @@ use PVE::Cluster;
use PVE::INotify;
use PVE::ProcFSTools;
use PVE::Tools;
-use PVE::Tools qw(version_cmp);
use base 'Exporter';
our @EXPORT_OK = qw(
diff --git a/src/PVE/QemuServer/Machine.pm b/src/PVE/QemuServer/Machine.pm
index 79ecbec3..fa47d668 100644
--- a/src/PVE/QemuServer/Machine.pm
+++ b/src/PVE/QemuServer/Machine.pm
@@ -3,6 +3,8 @@ package PVE::QemuServer::Machine;
use strict;
use warnings;
+use PVE::Tools;
+
use PVE::QemuServer::Helpers;
use PVE::QemuServer::MetaInfo;
use PVE::QemuServer::Monitor;
@@ -298,13 +300,8 @@ sub machine_version_cmp {
my ($major_a, $minor_a, $pve_a) = extract_version_parts($machine_type_a);
my ($major_b, $minor_b, $pve_b) = extract_version_parts($machine_type_b);
- return PVE::QemuServer::Helpers::version_cmp(
- $major_a,
- $major_b,
- $minor_a,
- $minor_b,
- $pve_a,
- $pve_b,
+ return PVE::Tools::version_cmp(
+ $major_a, $major_b, $minor_a, $minor_b, $pve_a, $pve_b,
);
}
@@ -345,7 +342,7 @@ sub can_run_pve_machine_version {
my $pvever = $3;
$kvmversion =~ m/(\d+)\.(\d+)/;
- return 0 if PVE::QemuServer::Helpers::version_cmp($1, $major, $2, $minor) < 0;
+ return 0 if PVE::Tools::version_cmp($1, $major, $2, $minor) < 0;
# if $pvever is missing or 0, we definitely support it as long as we didn't
# fail the QEMU version check above
diff --git a/src/PVE/QemuServer/QMPHelpers.pm b/src/PVE/QemuServer/QMPHelpers.pm
index f474c123..6d9b0063 100644
--- a/src/PVE/QemuServer/QMPHelpers.pm
+++ b/src/PVE/QemuServer/QMPHelpers.pm
@@ -2,6 +2,8 @@ package PVE::QemuServer::QMPHelpers;
use v5.36;
+use PVE::Tools;
+
use PVE::QemuServer::Helpers;
use PVE::QemuServer::Monitor qw(mon_cmd);
@@ -59,7 +61,7 @@ sub runs_at_least_qemu_version($vmid, $major, $minor, $extra = undef) {
die "could not query currently running version for VM $vmid\n" if !defined($v);
$v = $v->{qemu};
- return PVE::QemuServer::Helpers::version_cmp(
+ return PVE::Tools::version_cmp(
$v->{major}, $major, $v->{minor}, $minor, $v->{micro}, $extra,
) >= 0;
}
--
2.47.3
next reply other threads:[~2026-11-03 9:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 9:48 Fiona Ebner [this message]
2026-11-03 12:32 ` applied: [PATCH qemu-server] tree-wide: properly adapt all version_cmp() calls to moved helper Thomas Lamprecht
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=20261103095100.41582-1-f.ebner@proxmox.com \
--to=f.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.