all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] vm status: guard get_memory_stat() call with eval
@ 2026-01-22 12:10 Fiona Ebner
  0 siblings, 0 replies; only message in thread
From: Fiona Ebner @ 2026-01-22 12:10 UTC (permalink / raw)
  To: pve-devel

While in practice, it should be quite rare and unexpected for the
get_memory_stat() to fail, a single failing call should not fail the
whole pvestatd collection for VMs or even the single
'/qemu/{vmid}/status/current' API call for the affected VM, which e.g.
leads to the display for the VM in the UI being inaccessible.

One situation where it can happen is manually invoking the command
given by 'qm showcmd', because the process won't be part of the usual
systemd scope.

Fixes: 551c0078 ("fix #6935: vmstatus: use CGroup for host memory usage")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QemuServer.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index fc735aa3..7a0a2606 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -2589,7 +2589,8 @@ sub vmstatus {
         $d->{uptime} = int(($uptime - $pstat->{starttime}) / $cpuinfo->{user_hz});
 
         my $cgroup = PVE::QemuServer::CGroup->new($vmid);
-        my $cgroup_mem = $cgroup->get_memory_stat();
+        my $cgroup_mem = eval { $cgroup->get_memory_stat() } // {};
+        warn "unable to get memory stat for $vmid - $@" if $@;
         $d->{memhost} = $cgroup_mem->{mem} // 0;
 
         $d->{mem} = $d->{memhost}; # default to cgroup, balloon info can override this below
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-01-22 12:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-22 12:10 [pve-devel] [PATCH qemu-server] vm status: guard get_memory_stat() call with eval Fiona Ebner

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal