[pdm-devel] [PATCH datacenter-manager] ui: pve: correctly count 'total' cores/memory

Dominik Csapak d.csapak at proxmox.com
Mon Jan 13 11:09:55 CET 2025


so the number is what it says in the text ('total configured'), not the
configured but not running/currently used.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 ui/src/pve/remote.rs | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/ui/src/pve/remote.rs b/ui/src/pve/remote.rs
index 9a365e4..aafed5d 100644
--- a/ui/src/pve/remote.rs
+++ b/ui/src/pve/remote.rs
@@ -81,10 +81,9 @@ impl RemotePanelComp {
                 }
                 PveResource::Qemu(qemu) => {
                     guests += 1;
-                    if qemu.status == "stopped" {
-                        guest_cores += qemu.maxcpu;
-                        guest_memory += qemu.maxmem;
-                    } else {
+                    guest_cores += qemu.maxcpu;
+                    guest_memory += qemu.maxmem;
+                    if qemu.status != "stopped" {
                         guests_running += 1;
                         guest_cores_running += qemu.maxcpu;
                         guest_memory_running += qemu.maxmem;
@@ -92,10 +91,9 @@ impl RemotePanelComp {
                 }
                 PveResource::Lxc(lxc) => {
                     guests += 1;
-                    if lxc.status == "stopped" {
-                        guest_cores += lxc.maxcpu;
-                        guest_memory += lxc.maxmem;
-                    } else {
+                    guest_cores += lxc.maxcpu;
+                    guest_memory += lxc.maxmem;
+                    if lxc.status != "stopped" {
                         guests_running += 1;
                         guest_cores_running += lxc.maxcpu;
                         guest_memory_running += lxc.maxmem;
-- 
2.39.5





More information about the pdm-devel mailing list