From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 762581FF15C for ; Fri, 17 Oct 2025 16:11:42 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DA94F51AA; Fri, 17 Oct 2025 16:11:58 +0200 (CEST) From: Christian Ebner To: pdm-devel@lists.proxmox.com Date: Fri, 17 Oct 2025 16:11:33 +0200 Message-ID: <20251017141137.845295-8-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017141137.845295-1-c.ebner@proxmox.com> References: <20251017141137.845295-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1760710311594 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.042 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pdm-devel] [PATCH datacenter-manager v2 07/11] server: api: collect failed remotes list while getting status 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" Include name, remote type and error message for failed remotes when gathering status information, in order to be able to discriminate errors by remote type for the dashboard. Since the get_resources_impl has previously been adapted to return the full remote object as well, utilize that over get_resources to have the additional context. Signed-off-by: Christian Ebner --- changes since version 1: - Use new transient type from resource gathering - adapt to new refactored code server/src/api/resources.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs index b3f3ba2..fb281f4 100644 --- a/server/src/api/resources.rs +++ b/server/src/api/resources.rs @@ -9,9 +9,9 @@ use futures::FutureExt; use pbs_api_types::{DataStoreStatusListItem, NodeStatus}; use pdm_api_types::remotes::{Remote, RemoteType}; use pdm_api_types::resource::{ - PbsDatastoreResource, PbsNodeResource, PveLxcResource, PveNodeResource, PveQemuResource, - PveSdnResource, PveStorageResource, RemoteResources, Resource, ResourceType, ResourcesStatus, - SdnStatus, SdnZoneResource, TopEntities, + FailedRemote, PbsDatastoreResource, PbsNodeResource, PveLxcResource, PveNodeResource, + PveQemuResource, PveSdnResource, PveStorageResource, RemoteResources, Resource, ResourceType, + ResourcesStatus, SdnStatus, SdnZoneResource, TopEntities, }; use pdm_api_types::subscription::{ NodeSubscriptionInfo, RemoteSubscriptionState, RemoteSubscriptions, SubscriptionLevel, @@ -395,15 +395,20 @@ pub async fn get_status( max_age: u64, rpcenv: &mut dyn RpcEnvironment, ) -> Result { - let remotes = get_resources(max_age, None, None, rpcenv).await?; + let remotes_with_resources = get_resources_impl(max_age, None, None, Some(rpcenv)).await?; let mut counts = ResourcesStatus::default(); - for remote in remotes { - if remote.error.is_some() { + for remote_with_resources in remotes_with_resources { + if let Some(err) = remote_with_resources.error { counts.failed_remotes += 1; + counts.failed_remotes_list.push(FailedRemote { + name: remote_with_resources.remote_name, + error: err.to_string(), + remote_type: remote_with_resources.remote.ty, + }); } else { counts.remotes += 1; } - for resource in remote.resources { + for resource in remote_with_resources.resources { match resource { Resource::PveStorage(r) => match r.status.as_str() { "available" => counts.storages.available += 1, -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel