From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id AEA9F1FF165 for ; Thu, 25 Sep 2025 14:28:33 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id CE3C820561; Thu, 25 Sep 2025 14:29:05 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Thu, 25 Sep 2025 14:25:09 +0200 Message-ID: <20250925122829.70121-3-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20250925122829.70121-1-f.ebner@proxmox.com> References: <20250925122829.70121-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1758803298454 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.022 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 2/2] vm status: also queue query-proxmox-support QMP commands X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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 --- 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