From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH v3 qemu-server 3/3] print query-proxmox-support result in 'full' status
Date: Wed, 25 Nov 2020 10:09:10 +0100 [thread overview]
Message-ID: <1606295317.rggbpdsg10.astroid@nora.none> (raw)
In-Reply-To: <20201124154122.22202-4-s.reiter@proxmox.com>
this needs the following fix-up, else pvestatd spams the log for all not
runnning VMs:
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 6966717..0103386 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2750,6 +2750,8 @@ sub vmstatus {
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") };
On November 24, 2020 4:41 pm, Stefan Reiter wrote:
> Extends print_recursive_hash for the CLI to handle JSON booleans so the
> result will actually show up in 'qm status --verbose'.
>
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
>
> v3: unchanged
>
> PVE/CLI/qm.pm | 2 +-
> PVE/QemuServer.pm | 8 ++++++++
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
> index b3b9251..b9b6051 100755
> --- a/PVE/CLI/qm.pm
> +++ b/PVE/CLI/qm.pm
> @@ -110,7 +110,7 @@ sub print_recursive_hash {
> foreach my $item (@$hash) {
> print_recursive_hash("\t$prefix", $item);
> }
> - } elsif (!ref($hash) && defined($hash)) {
> + } elsif ((!ref($hash) && defined($hash)) || ref($hash) eq 'JSON::PP::Boolean') {
> if (defined($key)) {
> print "$prefix$key: $hash\n";
> } else {
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 9704042..6966717 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2748,6 +2748,14 @@ sub vmstatus {
>
> $qmpclient->queue_execute(undef, 2);
>
> + foreach my $vmid (keys %$list) {
> + next if $opt_vmid && ($vmid ne $opt_vmid);
> + # 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.20.1
>
>
>
> _______________________________________________
> 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:[~2020-11-25 9:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-24 15:41 [pve-devel] [PATCH v3 0/3] Add proxmox-backup-qemu version to VM status output Stefan Reiter
2020-11-24 15:41 ` [pve-devel] [PATCH v3 pve-qemu 1/3] update patches with squashed in 'include library version' Stefan Reiter
2020-11-25 10:59 ` [pve-devel] applied: " Fabian Grünbichler
2020-11-24 15:41 ` [pve-devel] [PATCH v3 proxmox-backup-qemu 2/3] return version via rust fn instead of header define Stefan Reiter
2020-11-25 7:36 ` [pve-devel] applied: " Dietmar Maurer
2020-11-24 15:41 ` [pve-devel] [PATCH v3 qemu-server 3/3] print query-proxmox-support result in 'full' status Stefan Reiter
2020-11-25 9:09 ` Fabian Grünbichler [this message]
2020-11-25 9:36 ` Stefan Reiter
2020-11-25 11:03 ` [pve-devel] applied: " Fabian Grünbichler
2020-11-24 16:29 ` [pve-devel] [PATCH v3 0/3] Add proxmox-backup-qemu version to VM status output Fabian Grünbichler
2020-11-24 18:27 ` Dietmar Maurer
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=1606295317.rggbpdsg10.astroid@nora.none \
--to=f.gruenbichler@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