[pve-devel] applied: [PATCH v3 qemu-server 3/3] print query-proxmox-support result in 'full' status

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Nov 25 12:03:14 CET 2020


with mentioned followup

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 at 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 at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 





More information about the pve-devel mailing list