From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 3F7F41FF191 for ; Tue, 21 Oct 2025 13:17:23 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B938E1BDD0; Tue, 21 Oct 2025 13:17:48 +0200 (CEST) From: Christian Ebner To: pdm-devel@lists.proxmox.com Date: Tue, 21 Oct 2025 13:11:25 +0200 Message-ID: <20251021111129.294349-16-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251021111129.294349-1-c.ebner@proxmox.com> References: <20251021111129.294349-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1761045096919 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.043 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [resources.rs, resource.rs] Subject: [pdm-devel] [PATCH datacenter-manager v3 15/19] server: resources: extend datastore status counters by multiple states X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" Account for some more states which will be shown in the datastore status panel of the dashboard. Signed-off-by: Christian Ebner --- Changes since version 2: - not present in previous version lib/pdm-api-types/src/resource.rs | 3 +++ server/src/api/resources.rs | 25 +++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/pdm-api-types/src/resource.rs b/lib/pdm-api-types/src/resource.rs index b779825..cc467d5 100644 --- a/lib/pdm-api-types/src/resource.rs +++ b/lib/pdm-api-types/src/resource.rs @@ -7,6 +7,9 @@ use proxmox_schema::{api, ApiStringFormat, ApiType, EnumEntry, OneOfSchema, Sche use super::remotes::{RemoteType, REMOTE_ID_SCHEMA}; +/// High PBS datastore usage threshold +pub const PBS_DATASTORE_HIGH_USAGE_THRESHOLD: f64 = 0.75; + #[api( "id-property": "id", "id-schema": { diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs index 793abfc..3b629d1 100644 --- a/server/src/api/resources.rs +++ b/server/src/api/resources.rs @@ -13,7 +13,7 @@ use pdm_api_types::remotes::{Remote, RemoteType}; use pdm_api_types::resource::{ FailedRemote, PbsDatastoreResource, PbsNodeResource, PveLxcResource, PveNodeResource, PveQemuResource, PveSdnResource, PveStorageResource, RemoteResources, Resource, ResourceType, - ResourcesStatus, SdnStatus, SdnZoneResource, TopEntities, + ResourcesStatus, SdnStatus, SdnZoneResource, TopEntities, PBS_DATASTORE_HIGH_USAGE_THRESHOLD, }; use pdm_api_types::subscription::{ NodeSubscriptionInfo, RemoteSubscriptionState, RemoteSubscriptions, SubscriptionLevel, @@ -450,7 +450,28 @@ pub async fn get_status( } // FIXME better status for pbs/datastores Resource::PbsNode(_) => counts.pbs_nodes.online += 1, - Resource::PbsDatastore(_) => counts.pbs_datastores.available += 1, + Resource::PbsDatastore(r) => { + if r.maintenance.is_none() { + counts.pbs_datastores.online += 1; + } else { + *counts.pbs_datastores.in_maintenance.get_or_insert_default() += 1; + } + if r.usage > PBS_DATASTORE_HIGH_USAGE_THRESHOLD { + *counts.pbs_datastores.high_usage.get_or_insert_default() += 1; + } + if r.backing_device.is_some() { + *counts.pbs_datastores.removable.get_or_insert_default() += 1; + } + match r.backend_type.as_deref() { + Some("s3") => { + *counts.pbs_datastores.s3_backend.get_or_insert_default() += 1; + } + Some("unknown") => { + *counts.pbs_datastores.unknown.get_or_insert_default() += 1; + } + _ => (), + } + } } } } -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel