public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH datacenter-manager v3] server: api: resources: handle template in status count
@ 2025-04-18  6:42 Dominik Csapak
  0 siblings, 0 replies; only message in thread
From: Dominik Csapak @ 2025-04-18  6:42 UTC (permalink / raw)
  To: pdm-devel

Originally, the PVE API schema description did not include the template
flag (so the information was not present in the rust types).

We added that in pve-manager with:
5c6331cf (api: cluster/resources: add missing return properties)

Then got that into the rust types with this commit in proxmox-api-types:
04a8f57 (pve-api-types: regenerate code)

And finally used it first in PDM (but forgot to use it here) with:
f7f47e1 (types/server: add tags and tepmlate to qemu/lxc resource type)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v2:
* improved commit message by adding the commit references that are relevant
 server/src/api/resources.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
index 453d9e8..ddcee7e 100644
--- a/server/src/api/resources.rs
+++ b/server/src/api/resources.rs
@@ -191,14 +191,14 @@ pub async fn get_status(
                     _ => counts.storages.unknown += 1,
                 },
                 Resource::PveQemu(r) => match r.status.as_str() {
+                    _ if r.template => counts.qemu.template += 1,
                     "running" => counts.qemu.running += 1,
-                    // FIXME: handle templates
                     "stopped" => counts.qemu.stopped += 1,
                     _ => counts.qemu.unknown += 1,
                 },
                 Resource::PveLxc(r) => match r.status.as_str() {
+                    _ if r.template => counts.lxc.template += 1,
                     "running" => counts.lxc.running += 1,
-                    // FIXME: handle templates
                     "stopped" => counts.lxc.stopped += 1,
                     _ => counts.lxc.unknown += 1,
                 },
-- 
2.39.5



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


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

only message in thread, other threads:[~2025-04-18  6:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-18  6:42 [pdm-devel] [PATCH datacenter-manager v3] server: api: resources: handle template in status count Dominik Csapak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal