[pve-devel] [PATCH manager v2 5/5] api2tools: extract_vm_status add new vm memhost column

Aaron Lauterer a.lauterer at proxmox.com
Wed Jul 9 18:36:56 CEST 2025


as this will also be displayed in the status of VMs

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---

Notes:
    this is a dedicated patch that should be applied only for PVE9 as it
    adds new data in the result

 PVE/API2/Cluster.pm | 7 +++++++
 PVE/API2Tools.pm    | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm
index a025d264..81cdf217 100644
--- a/PVE/API2/Cluster.pm
+++ b/PVE/API2/Cluster.pm
@@ -301,6 +301,13 @@ __PACKAGE__->register_method({
                     renderer => 'bytes',
                     minimum => 0,
                 },
+                memhost => {
+                    description => "Used memory in bytes from the point of view of the host (for types 'qemu').",
+                    type => 'integer',
+                    optional => 1,
+                    renderer => 'bytes',
+                    minimum => 0,
+                },
                 maxmem => {
                     description => "Number of available memory in bytes"
                         . " (for types 'node', 'qemu' and 'lxc').",
diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
index 08548524..ed0bddbf 100644
--- a/PVE/API2Tools.pm
+++ b/PVE/API2Tools.pm
@@ -133,6 +133,9 @@ sub extract_vm_stats {
         $entry->{netout} = ($d->[12] || 0) + 0;
         $entry->{diskread} = ($d->[13] || 0) + 0;
         $entry->{diskwrite} = ($d->[14] || 0) + 0;
+        if ($key =~ /^pve-vm-/) {
+            $entry->{memhost} = ($d->[15] || 0) +0;
+        }
     }
 
     return $entry;
-- 
2.39.5





More information about the pve-devel mailing list