From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 2/2] vm status: also queue query-proxmox-support QMP commands
Date: Thu, 25 Sep 2025 14:25:09 +0200 [thread overview]
Message-ID: <20250925122829.70121-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250925122829.70121-1-f.ebner@proxmox.com>
The vmstatus() function is used by pvestatd and needs to be fast.
However, the 'query-proxmox-support' querying is done sequentially for
each VM and each query has its own timeout (it's the default 5
seconds). If QMP is blocked for some reason for a single VM, that
already adds 5 seconds to the whole operation. Compared with the whole
stats querying queue, which is allowed to use 3 seconds in total, this
is rather extreme and needs to be fixed.
Back when commit 6891fd70 ("print query-proxmox-support result in
'full' status") was implemented, not all supported QEMU versions in
Proxmox VE implemented the 'query-proxmox-support' QMP command.
Because of this, the queue might be interrupted if ordering this
command too early. It still could've been ordered before the
'query-balloon' one, which also can fail. Nowadays, all supported QEMU
versions do implement the command and this just returns static
information which cannot fail (as long as QMP communication itself
works), so it can also be ordered at the beginning of the queue (after
the main 'query-status').
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
New in v2.
src/PVE/QemuServer.pm | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index d6d0cb13..7d5ab718 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -2886,9 +2886,15 @@ sub vmstatus {
$res->{$vmid}->{'running-qemu'} = $version;
};
+ my $proxmox_support_cb = sub {
+ my ($vmid, $resp) = @_;
+ $res->{$vmid}->{'proxmox-support'} = $resp->{'return'} // {};
+ };
+
my $statuscb = sub {
my ($vmid, $resp) = @_;
+ $qmpclient->queue_cmd($vmid, $proxmox_support_cb, 'query-proxmox-support');
$qmpclient->queue_cmd($vmid, $blockstatscb, 'query-blockstats');
$qmpclient->queue_cmd($vmid, $machinecb, 'query-machines');
$qmpclient->queue_cmd($vmid, $versioncb, 'query-version');
@@ -2913,16 +2919,6 @@ sub vmstatus {
$qmpclient->queue_execute(undef, 2);
- foreach my $vmid (keys %$list) {
- next if $opt_vmid && ($vmid ne $opt_vmid);
- next if !$res->{$vmid}->{pid}; #not running
-
- # we can't use the $qmpclient since it might have already aborted on
- # 'query-balloon', but this might also fail for older versions...
- my $qemu_support = eval { mon_cmd($vmid, "query-proxmox-support") };
- $res->{$vmid}->{'proxmox-support'} = $qemu_support // {};
- }
-
foreach my $vmid (keys %$list) {
next if $opt_vmid && ($vmid ne $opt_vmid);
$res->{$vmid}->{qmpstatus} = $res->{$vmid}->{status} if !$res->{$vmid}->{qmpstatus};
--
2.47.3
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-09-25 12:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-25 12:25 [pve-devel] [PATCH-SERIES v2 qemu-server 0/2] fix #6207: vm status fixes Fiona Ebner
2025-09-25 12:25 ` [pve-devel] [PATCH v2 qemu-server 1/2] fix #6207: vm status: return undef values when disk{read, write} cannot be queried Fiona Ebner
2025-09-25 12:25 ` Fiona Ebner [this message]
2025-09-25 14:13 ` [pve-devel] applied: [PATCH-SERIES v2 qemu-server 0/2] fix #6207: vm status fixes 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=20250925122829.70121-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox