From: "Lukas Wagner" <l.wagner@proxmox.com>
To: "Dominik Csapak" <d.csapak@proxmox.com>, <pdm-devel@lists.proxmox.com>
Subject: Re: [PATCH datacenter-manager v2 1/4] api: return global cpu/memory/storage statistics
Date: Wed, 01 Apr 2026 13:34:38 +0200 [thread overview]
Message-ID: <DHHSBSPC8IRD.2VL27YZ9KK8XB@proxmox.com> (raw)
In-Reply-To: <20260330131044.693709-2-d.csapak@proxmox.com>
Looking good, some tiny suggestions for improvement inline.
Can also be fixed in a small follow-up patch in case there is nothing
else that needs to be changed.
On Mon Mar 30, 2026 at 3:07 PM CEST, Dominik Csapak wrote:
> Global CPU/memory/storage usage (per remote type) is useful and
> interesting from an administration POV. Calculate and return these so
> we can use them on the dashboards.
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> lib/pdm-api-types/src/lib.rs | 14 ++++++-
> lib/pdm-api-types/src/resource.rs | 27 +++++++++++++
> server/src/api/resources.rs | 65 ++++++++++++++++++++++++-------
> 3 files changed, 92 insertions(+), 14 deletions(-)
>
> diff --git a/lib/pdm-api-types/src/lib.rs b/lib/pdm-api-types/src/lib.rs
> index d4cc7ef0..28aed3f4 100644
> --- a/lib/pdm-api-types/src/lib.rs
> +++ b/lib/pdm-api-types/src/lib.rs
> @@ -191,7 +191,7 @@ pub const PVE_STORAGE_ID_SCHEMA: Schema = StringSchema::new("Storage ID.")
> // Complex type definitions
>
> #[api()]
> -#[derive(Default, Serialize, Deserialize)]
> +#[derive(Default, Serialize, Deserialize, PartialEq, Clone)]
> /// Storage space usage information.
> pub struct StorageStatus {
> /// Total space (bytes).
> @@ -202,6 +202,18 @@ pub struct StorageStatus {
> pub avail: u64,
> }
>
> +#[api()]
nit: you can leave out the parentheses: #[api]
> +#[derive(Default, Serialize, Deserialize, PartialEq, Clone)]
> +/// Storage space usage information.
^ The doc comment seems to be wrong (copy/paste mistake?)
> +pub struct MemoryStatus {
> + /// Total memory size (bytes).
> + pub total: u64,
> + /// Used memory (bytes).
> + pub used: u64,
> + /// Available memory (bytes).
> + pub avail: u64,
> +}
> +
> pub const PASSWORD_HINT_SCHEMA: Schema = StringSchema::new("Password hint.")
> .format(&SINGLE_LINE_COMMENT_FORMAT)
> .min_length(1)
> diff --git a/lib/pdm-api-types/src/resource.rs b/lib/pdm-api-types/src/resource.rs
> index d2db3b5a..01a5eb6c 100644
> --- a/lib/pdm-api-types/src/resource.rs
> +++ b/lib/pdm-api-types/src/resource.rs
> @@ -6,6 +6,8 @@ use serde::{Deserialize, Serialize};
> use proxmox_schema::{api, ApiStringFormat, ApiType, EnumEntry, OneOfSchema, Schema, StringSchema};
>
> use super::remotes::{RemoteType, REMOTE_ID_SCHEMA};
> +use super::{MemoryStatus, StorageStatus};
> +
> use pve_api_types::ClusterResourceNetworkType;
>
> /// High PBS datastore usage threshold
> @@ -666,6 +668,18 @@ pub struct SdnZoneCount {
> pub unknown: u64,
> }
>
> +#[api]
> +#[derive(Default, Serialize, Deserialize, Clone, PartialEq)]
> +/// Statistics for CPU utilization
> +pub struct CpuStatistics {
> + /// Amount of threads utilized
'thread' is a countable noun, so it should rather be "Number of threads"
> + pub used: f64,
> + /// Amount of physically available cpu threads
same here
> + pub max: f64,
> + /// Currently allocated cores of running guests (only on PVE)
> + pub allocated: Option<f64>,
> +}
> +
next prev parent reply other threads:[~2026-04-01 11:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 13:07 [PATCH datacenter-manager v2 0/4] add resource gauge panels to dashboard/views Dominik Csapak
2026-03-30 13:07 ` [PATCH datacenter-manager v2 1/4] api: return global cpu/memory/storage statistics Dominik Csapak
2026-04-01 11:34 ` Lukas Wagner [this message]
2026-04-02 13:02 ` Dominik Csapak
2026-04-02 13:48 ` Lukas Wagner
2026-03-30 13:07 ` [PATCH datacenter-manager v2 2/4] ui: css: use mask for svg icons Dominik Csapak
2026-03-30 13:07 ` [PATCH datacenter-manager v2 3/4] ui: dashboard: add new gauge panels widget type Dominik Csapak
2026-04-01 11:34 ` Lukas Wagner
2026-04-01 11:36 ` Lukas Wagner
2026-03-30 13:07 ` [PATCH datacenter-manager v2 4/4] ui: dashboard: add resource gauges to default dashboard Dominik Csapak
2026-04-01 11:34 ` [PATCH datacenter-manager v2 0/4] add resource gauge panels to dashboard/views Lukas Wagner
2026-04-02 13:24 ` superseded: " Dominik Csapak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DHHSBSPC8IRD.2VL27YZ9KK8XB@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=d.csapak@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox