* [pdm-devel] [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard
@ 2025-10-13 8:56 Christian Ebner
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 1/7] server: api: add remote-type search category for resources Christian Ebner
` (7 more replies)
0 siblings, 8 replies; 19+ messages in thread
From: Christian Ebner @ 2025-10-13 8:56 UTC (permalink / raw)
To: pdm-devel
Extends the search capability to filter resource by remote type, so
this can be used to further filter the status information gathering
as well.
Extend the PVE node status panel implementation to be reusabe for the
PBS node status as well and add a list of failed remotes to the status
api response, which allows to further discriminate errors by remote
type and show the type specific status message accordingly.
datacenter-manager:
Christian Ebner (7):
server: api: add remote-type search category for resources
pdm-api-types: extend resource status by list of failed remotes
server: api: collect failed remotes list while getting status
ui: dashboard: extend node panel creation by remote type
ui: dashboard: distinguish failed remotes based on remote type
ui: dashboard: expose PBS nodes status panel
ui: dashboard: filter by remote type for PVE and PBS node status panel
lib/pdm-api-types/src/remotes.rs | 3 +-
lib/pdm-api-types/src/resource.rs | 28 +++++-
server/src/api/resources.rs | 149 ++++++++++++++++++++----------
ui/src/dashboard/mod.rs | 64 +++++++++----
4 files changed, 173 insertions(+), 71 deletions(-)
Summary over all repositories:
4 files changed, 173 insertions(+), 71 deletions(-)
--
Generated by git-murpp 0.8.1
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* [pdm-devel] [PATCH datacenter-manager 1/7] server: api: add remote-type search category for resources
2025-10-13 8:56 [pdm-devel] [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard Christian Ebner
@ 2025-10-13 8:56 ` Christian Ebner
2025-10-14 8:35 ` Dominik Csapak
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 2/7] pdm-api-types: extend resource status by list of failed remotes Christian Ebner
` (6 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Christian Ebner @ 2025-10-13 8:56 UTC (permalink / raw)
To: pdm-devel
Extend the current search capability for resources by adding the
`RemoteType` search category, allowing to selectively filter remotes
of type PVE and PBS. While extending the search capabilities, this
will also be used to filter the resources to be gathered on status
api calls, to refine statistics based on remote type.
Since the current remote filtering is only applied in case of remotes
only search, add an additional helper to pre-filter the to be fetched
resources by the remote type.
With this it is now possible to search, e.g. `remote-type:pbs` to
only get resources from PBS remotes.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
server/src/api/resources.rs | 44 +++++++++++++++++++++++++++++++++----
1 file changed, 40 insertions(+), 4 deletions(-)
diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
index f4f56bc..029106f 100644
--- a/server/src/api/resources.rs
+++ b/server/src/api/resources.rs
@@ -56,6 +56,7 @@ enum MatchCategory {
Status,
Template,
Remote,
+ RemoteType,
}
impl std::str::FromStr for MatchCategory {
@@ -69,6 +70,7 @@ impl std::str::FromStr for MatchCategory {
"status" => MatchCategory::Status,
"template" => MatchCategory::Template,
"remote" => MatchCategory::Remote,
+ "remote-type" => MatchCategory::RemoteType,
_ => bail!("invalid category"),
};
Ok(category)
@@ -88,11 +90,18 @@ impl MatchCategory {
(Ok(a), Ok(b)) => a == b,
_ => false,
},
+ MatchCategory::RemoteType => match (
+ RemoteType::from_str(value),
+ RemoteType::from_str(search_term),
+ ) {
+ (Ok(a), Ok(b)) => a == b,
+ _ => false,
+ },
}
}
}
-// returns None if we can't decide if it matches, currently only for the `Remote` category`
+// returns None if we can't decide if it matches, currently only for the `RemoteType` category
fn resource_matches_search_term(
remote_name: &str,
resource: &Resource,
@@ -112,6 +121,7 @@ fn resource_matches_search_term(
_ => false,
},
MatchCategory::Remote => category.matches(remote_name, &term.value),
+ MatchCategory::RemoteType => return None,
},
Some(Err(_)) => false,
None => {
@@ -122,7 +132,12 @@ fn resource_matches_search_term(
Some(matches)
}
-fn remote_matches_search_term(remote_name: &str, online: Option<bool>, term: &SearchTerm) -> bool {
+fn remote_matches_search_term(
+ remote_name: &str,
+ online: Option<bool>,
+ remote_type: Option<RemoteType>,
+ term: &SearchTerm,
+) -> bool {
match term.category.as_deref().map(|c| c.parse::<MatchCategory>()) {
Some(Ok(category)) => match category {
MatchCategory::Type => category.matches("remote", &term.value),
@@ -135,6 +150,10 @@ fn remote_matches_search_term(remote_name: &str, online: Option<bool>, term: &Se
None => true,
},
MatchCategory::Template => false,
+ MatchCategory::RemoteType => match remote_type {
+ Some(remote_type) => category.matches(&remote_type.to_string(), &term.value),
+ None => true,
+ },
},
Some(Err(_)) => false,
None => {
@@ -144,6 +163,17 @@ fn remote_matches_search_term(remote_name: &str, online: Option<bool>, term: &Se
}
}
+fn remote_type_matches_search_term(remote_type: RemoteType, term: &SearchTerm) -> bool {
+ match term.category.as_deref().map(|c| c.parse::<MatchCategory>()) {
+ Some(Ok(category)) => match category {
+ MatchCategory::RemoteType => category.matches(&remote_type.to_string(), &term.value),
+ _ => true,
+ },
+ Some(Err(_)) => false,
+ None => true,
+ }
+}
+
#[api(
// FIXME:: see list-like API calls in resource routers, we probably want more fine-grained
// checks..
@@ -248,8 +278,14 @@ pub(crate) async fn get_resources_impl(
}
}
+ if !filters.matches(|term| remote_type_matches_search_term(remote.ty, term)) {
+ continue;
+ }
+
if remotes_only
- && !filters.matches(|term| remote_matches_search_term(&remote_name, None, term))
+ && !filters.matches(|term| {
+ remote_matches_search_term(&remote_name, None, Some(remote.ty), term)
+ })
{
continue;
}
@@ -301,7 +337,7 @@ pub(crate) async fn get_resources_impl(
return true;
}
filters.matches(|filter| {
- remote_matches_search_term(&res.remote, Some(res.error.is_none()), filter)
+ remote_matches_search_term(&res.remote, Some(res.error.is_none()), None, filter)
})
})
}
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* [pdm-devel] [PATCH datacenter-manager 2/7] pdm-api-types: extend resource status by list of failed remotes
2025-10-13 8:56 [pdm-devel] [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard Christian Ebner
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 1/7] server: api: add remote-type search category for resources Christian Ebner
@ 2025-10-13 8:56 ` Christian Ebner
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 3/7] server: api: collect failed remotes list while getting status Christian Ebner
` (5 subsequent siblings)
7 siblings, 0 replies; 19+ messages in thread
From: Christian Ebner @ 2025-10-13 8:56 UTC (permalink / raw)
To: pdm-devel
Currently only the count of failed remotes is returned via the
status. Include the list of failed remotes including the name,
remote type and error message.
This will be used to extend the dashboard panel.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
lib/pdm-api-types/src/remotes.rs | 3 ++-
lib/pdm-api-types/src/resource.rs | 28 ++++++++++++++++++++++++++--
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/lib/pdm-api-types/src/remotes.rs b/lib/pdm-api-types/src/remotes.rs
index 6318943..dd6afa6 100644
--- a/lib/pdm-api-types/src/remotes.rs
+++ b/lib/pdm-api-types/src/remotes.rs
@@ -39,10 +39,11 @@ pub struct NodeUrl {
#[api]
/// The type of a remote entry.
-#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize, Ord, PartialOrd)]
+#[derive(Clone, Copy, Default, Debug, Eq, PartialEq, Deserialize, Serialize, Ord, PartialOrd)]
#[serde(rename_all = "lowercase")]
pub enum RemoteType {
/// A Proxmox VE node.
+ #[default]
Pve,
/// A Proxmox Backup Server node.
Pbs,
diff --git a/lib/pdm-api-types/src/resource.rs b/lib/pdm-api-types/src/resource.rs
index b219250..400f2af 100644
--- a/lib/pdm-api-types/src/resource.rs
+++ b/lib/pdm-api-types/src/resource.rs
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
use proxmox_schema::{api, ApiStringFormat, ApiType, EnumEntry, OneOfSchema, Schema, StringSchema};
-use super::remotes::REMOTE_ID_SCHEMA;
+use super::remotes::{RemoteType, REMOTE_ID_SCHEMA};
#[api(
"id-property": "id",
@@ -550,7 +550,16 @@ pub struct SdnZoneCount {
pub unknown: u64,
}
-#[api]
+#[api(
+ properties: {
+ "failed_remotes_list": {
+ type: Array,
+ items: {
+ type: FailedRemote,
+ },
+ }
+ }
+)]
#[derive(Default, Serialize, Deserialize, Clone, PartialEq)]
/// Describes the status of seen resources
pub struct ResourcesStatus {
@@ -572,6 +581,21 @@ pub struct ResourcesStatus {
pub pbs_nodes: NodeStatusCount,
/// Status of PBS Datastores
pub pbs_datastores: StorageStatusCount,
+ /// List of the failed remotes including type and error
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ pub failed_remotes_list: Vec<FailedRemote>,
+}
+
+#[api]
+#[derive(Default, Serialize, Deserialize, Clone, PartialEq)]
+/// Error information for a failed remote
+pub struct FailedRemote {
+ /// Name of the failed remote
+ pub name: String,
+ /// Error that occurred when querying remote resources
+ pub error: String,
+ /// Type of the failed remote
+ pub remote_type: RemoteType,
}
#[api(
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* [pdm-devel] [PATCH datacenter-manager 3/7] server: api: collect failed remotes list while getting status
2025-10-13 8:56 [pdm-devel] [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard Christian Ebner
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 1/7] server: api: add remote-type search category for resources Christian Ebner
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 2/7] pdm-api-types: extend resource status by list of failed remotes Christian Ebner
@ 2025-10-13 8:56 ` Christian Ebner
2025-10-14 8:37 ` Dominik Csapak
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 4/7] ui: dashboard: extend node panel creation by remote type Christian Ebner
` (4 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Christian Ebner @ 2025-10-13 8:56 UTC (permalink / raw)
To: 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. To get the per-remote-type
resources, utilize the now previously exposed remote type filtering
for resources.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
server/src/api/resources.rs | 105 ++++++++++++++++++++----------------
1 file changed, 58 insertions(+), 47 deletions(-)
diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
index 029106f..33da5c2 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,
@@ -373,55 +373,66 @@ pub async fn get_status(
max_age: u64,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<ResourcesStatus, Error> {
- let remotes = get_resources(max_age, None, None, rpcenv).await?;
let mut counts = ResourcesStatus::default();
- for remote in remotes {
- if remote.error.is_some() {
- counts.failed_remotes += 1;
- } else {
- counts.remotes += 1;
- }
- for resource in remote.resources {
- match resource {
- Resource::PveStorage(r) => match r.status.as_str() {
- "available" => counts.storages.available += 1,
- _ => counts.storages.unknown += 1,
- },
- Resource::PveQemu(r) => match r.status.as_str() {
- _ if r.template => counts.qemu.template += 1,
- "running" => counts.qemu.running += 1,
- "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,
- "stopped" => counts.lxc.stopped += 1,
- _ => counts.lxc.unknown += 1,
- },
- Resource::PveNode(r) => match r.status.as_str() {
- "online" => counts.pve_nodes.online += 1,
- "offline" => counts.pve_nodes.offline += 1,
- _ => counts.pve_nodes.unknown += 1,
- },
- Resource::PveSdn(r) => {
- if let PveSdnResource::Zone(_) = &r {
- match r.status() {
- SdnStatus::Available => {
- counts.sdn_zones.available += 1;
- }
- SdnStatus::Error => {
- counts.sdn_zones.error += 1;
- }
- SdnStatus::Unknown => {
- counts.sdn_zones.unknown += 1;
+ for remote_type in [RemoteType::Pve, RemoteType::Pbs] {
+ let remote_type_search =
+ SearchTerm::new(remote_type.to_string()).category(Some("remote-type"));
+ let remote_type_search = remote_type_search.to_string();
+ let remotes =
+ get_resources_impl(max_age, Some(remote_type_search), None, Some(rpcenv)).await?;
+ for remote in remotes {
+ if let Some(err) = remote.error {
+ counts.failed_remotes += 1;
+ counts.failed_remotes_list.push(FailedRemote {
+ name: remote.remote,
+ error: err.to_string(),
+ remote_type,
+ });
+ } else {
+ counts.remotes += 1;
+ }
+ for resource in remote.resources {
+ match resource {
+ Resource::PveStorage(r) => match r.status.as_str() {
+ "available" => counts.storages.available += 1,
+ _ => counts.storages.unknown += 1,
+ },
+ Resource::PveQemu(r) => match r.status.as_str() {
+ _ if r.template => counts.qemu.template += 1,
+ "running" => counts.qemu.running += 1,
+ "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,
+ "stopped" => counts.lxc.stopped += 1,
+ _ => counts.lxc.unknown += 1,
+ },
+ Resource::PveNode(r) => match r.status.as_str() {
+ "online" => counts.pve_nodes.online += 1,
+ "offline" => counts.pve_nodes.offline += 1,
+ _ => counts.pve_nodes.unknown += 1,
+ },
+ Resource::PveSdn(r) => {
+ if let PveSdnResource::Zone(_) = &r {
+ match r.status() {
+ SdnStatus::Available => {
+ counts.sdn_zones.available += 1;
+ }
+ SdnStatus::Error => {
+ counts.sdn_zones.error += 1;
+ }
+ SdnStatus::Unknown => {
+ counts.sdn_zones.unknown += 1;
+ }
}
}
}
+ // FIXME better status for pbs/datastores
+ Resource::PbsNode(_) => counts.pbs_nodes.online += 1,
+ Resource::PbsDatastore(_) => counts.pbs_datastores.available += 1,
}
- // FIXME better status for pbs/datastores
- Resource::PbsNode(_) => counts.pbs_nodes.online += 1,
- Resource::PbsDatastore(_) => counts.pbs_datastores.available += 1,
}
}
}
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* [pdm-devel] [PATCH datacenter-manager 4/7] ui: dashboard: extend node panel creation by remote type
2025-10-13 8:56 [pdm-devel] [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard Christian Ebner
` (2 preceding siblings ...)
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 3/7] server: api: collect failed remotes list while getting status Christian Ebner
@ 2025-10-13 8:56 ` Christian Ebner
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 5/7] ui: dashboard: distinguish failed remotes based on " Christian Ebner
` (3 subsequent siblings)
7 siblings, 0 replies; 19+ messages in thread
From: Christian Ebner @ 2025-10-13 8:56 UTC (permalink / raw)
To: pdm-devel
Make the node panel instantiation logic reusable for the PBS remotes
by passing the remote type as additional parameter, switching the
rendered node status information based on that.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
ui/src/dashboard/mod.rs | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs
index f54c509..ff63f6a 100644
--- a/ui/src/dashboard/mod.rs
+++ b/ui/src/dashboard/mod.rs
@@ -158,16 +158,26 @@ impl PdmDashboard {
.into()
}
- fn create_node_panel(&self, ctx: &yew::Context<Self>, icon: &str, title: String) -> Panel {
+ fn create_node_panel(
+ &self,
+ ctx: &yew::Context<Self>,
+ icon: &str,
+ title: String,
+ remote_type: RemoteType,
+ ) -> Panel {
let mut search_terms = vec![SearchTerm::new("node").category(Some("type"))];
let (status_icon, text): (Fa, String) = match &self.status {
Some(status) => {
- match status.pve_nodes {
+ let node_status = match remote_type {
+ RemoteType::Pve => &status.pve_nodes,
+ RemoteType::Pbs => &status.pbs_nodes,
+ };
+ match node_status {
NodeStatusCount {
online,
offline,
unknown,
- } if offline > 0 => {
+ } if *offline > 0 => {
search_terms.push(SearchTerm::new("offline").category(Some("status")));
(
Status::Error.into(),
@@ -178,7 +188,7 @@ impl PdmDashboard {
),
)
}
- NodeStatusCount { unknown, .. } if unknown > 0 => {
+ NodeStatusCount { unknown, .. } if *unknown > 0 => {
search_terms.push(SearchTerm::new("unknown").category(Some("status")));
(
Status::Warning.into(),
@@ -567,6 +577,7 @@ impl Component for PdmDashboard {
ctx,
"building",
tr!("Virtual Environment Nodes"),
+ RemoteType::Pve,
))
.with_child(self.create_guest_panel(GuestType::Qemu))
.with_child(self.create_guest_panel(GuestType::Lxc))
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* [pdm-devel] [PATCH datacenter-manager 5/7] ui: dashboard: distinguish failed remotes based on remote type
2025-10-13 8:56 [pdm-devel] [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard Christian Ebner
` (3 preceding siblings ...)
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 4/7] ui: dashboard: extend node panel creation by remote type Christian Ebner
@ 2025-10-13 8:56 ` Christian Ebner
2025-10-14 8:47 ` Dominik Csapak
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 6/7] ui: dashboard: expose PBS nodes status panel Christian Ebner
` (2 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Christian Ebner @ 2025-10-13 8:56 UTC (permalink / raw)
To: pdm-devel
The status information api call has been extended to include type and
error information.
Use this information to distinguish how to show the respective node
status message. The number of failed remotes does not take into account
which type it is, so use the failed nodes list to filter for the
respective remote. Further, as a PVE node can have multiple nodes while
the PBS remote is limited to one node, so discriminate that in the
status as well.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
ui/src/dashboard/mod.rs | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs
index ff63f6a..da62262 100644
--- a/ui/src/dashboard/mod.rs
+++ b/ui/src/dashboard/mod.rs
@@ -27,7 +27,7 @@ use pwt::{
use pdm_api_types::{
remotes::RemoteType,
- resource::{NodeStatusCount, ResourcesStatus},
+ resource::{FailedRemote, NodeStatusCount, ResourcesStatus},
TaskStatistics,
};
use pdm_client::types::TopEntity;
@@ -195,11 +195,26 @@ impl PdmDashboard {
tr!("{0} nodes have an unknown status", unknown),
)
}
- // FIXME, get more detailed status about the failed remotes (name, type, error)?
- NodeStatusCount { online, .. } if status.failed_remotes > 0 => (
- Status::Unknown.into(),
- tr!("{0} of an unknown number of nodes online", online),
- ),
+ NodeStatusCount { online, .. } if status.failed_remotes > 0 => {
+ let failed_remotes: Vec<&FailedRemote> = status
+ .failed_remotes_list
+ .iter()
+ .filter(|item| item.remote_type == remote_type)
+ .collect();
+ if failed_remotes.is_empty() {
+ (Status::Success.into(), tr!("{0} nodes online", online))
+ } else if remote_type == RemoteType::Pbs {
+ (
+ Status::Error.into(),
+ tr!("{0} remotes failed", failed_remotes.len()),
+ )
+ } else {
+ (
+ Status::Unknown.into(),
+ tr!("{0} of an unknown number of nodes online", online),
+ )
+ }
+ }
NodeStatusCount { online, .. } => {
(Status::Success.into(), tr!("{0} nodes online", online))
}
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* [pdm-devel] [PATCH datacenter-manager 6/7] ui: dashboard: expose PBS nodes status panel
2025-10-13 8:56 [pdm-devel] [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard Christian Ebner
` (4 preceding siblings ...)
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 5/7] ui: dashboard: distinguish failed remotes based on " Christian Ebner
@ 2025-10-13 8:56 ` Christian Ebner
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 7/7] ui: dashboard: filter by remote type for PVE and PBS node " Christian Ebner
2025-10-17 14:13 ` [pdm-devel] superseded: [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard Christian Ebner
7 siblings, 0 replies; 19+ messages in thread
From: Christian Ebner @ 2025-10-13 8:56 UTC (permalink / raw)
To: pdm-devel
Analogous to the node status information shown for PVE nodes, allows
to get a fast overview if all PBS remotes/nodes are reachable or not.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
ui/src/dashboard/mod.rs | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs
index da62262..1ec0456 100644
--- a/ui/src/dashboard/mod.rs
+++ b/ui/src/dashboard/mod.rs
@@ -596,12 +596,13 @@ impl Component for PdmDashboard {
))
.with_child(self.create_guest_panel(GuestType::Qemu))
.with_child(self.create_guest_panel(GuestType::Lxc))
- // FIXME: add PBS support
- //.with_child(self.create_node_panel(
- // "building-o",
- // tr!("Backup Server Nodes"),
- // &self.status.pbs_nodes,
- //))
+ .with_child(self.create_node_panel(
+ ctx,
+ "building-o",
+ tr!("Backup Server Nodes"),
+ RemoteType::Pbs,
+ ))
+ // FIXME: add further PBS support
//.with_child(
// Panel::new()
// .flex(1.0)
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* [pdm-devel] [PATCH datacenter-manager 7/7] ui: dashboard: filter by remote type for PVE and PBS node status panel
2025-10-13 8:56 [pdm-devel] [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard Christian Ebner
` (5 preceding siblings ...)
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 6/7] ui: dashboard: expose PBS nodes status panel Christian Ebner
@ 2025-10-13 8:56 ` Christian Ebner
2025-10-17 14:13 ` [pdm-devel] superseded: [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard Christian Ebner
7 siblings, 0 replies; 19+ messages in thread
From: Christian Ebner @ 2025-10-13 8:56 UTC (permalink / raw)
To: pdm-devel
Instead of showing the node type resources unconditionally when clicking
the PVE or PBS node panel, distinguish based on the recently added
remote type filtering capability.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
ui/src/dashboard/mod.rs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs
index 1ec0456..911e48b 100644
--- a/ui/src/dashboard/mod.rs
+++ b/ui/src/dashboard/mod.rs
@@ -165,7 +165,10 @@ impl PdmDashboard {
title: String,
remote_type: RemoteType,
) -> Panel {
- let mut search_terms = vec![SearchTerm::new("node").category(Some("type"))];
+ let mut search_terms = vec![
+ SearchTerm::new("node").category(Some("type")),
+ SearchTerm::new(remote_type.to_string()).category(Some("remote-type")),
+ ];
let (status_icon, text): (Fa, String) = match &self.status {
Some(status) => {
let node_status = match remote_type {
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [pdm-devel] [PATCH datacenter-manager 1/7] server: api: add remote-type search category for resources
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 1/7] server: api: add remote-type search category for resources Christian Ebner
@ 2025-10-14 8:35 ` Dominik Csapak
2025-10-14 9:01 ` Christian Ebner
0 siblings, 1 reply; 19+ messages in thread
From: Dominik Csapak @ 2025-10-14 8:35 UTC (permalink / raw)
To: Proxmox Datacenter Manager development discussion, Christian Ebner
one comment inline
On 10/13/25 10:56 AM, Christian Ebner wrote:
> Extend the current search capability for resources by adding the
> `RemoteType` search category, allowing to selectively filter remotes
> of type PVE and PBS. While extending the search capabilities, this
> will also be used to filter the resources to be gathered on status
> api calls, to refine statistics based on remote type.
>
> Since the current remote filtering is only applied in case of remotes
> only search, add an additional helper to pre-filter the to be fetched
> resources by the remote type.
>
> With this it is now possible to search, e.g. `remote-type:pbs` to
> only get resources from PBS remotes.
>
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
> server/src/api/resources.rs | 44 +++++++++++++++++++++++++++++++++----
> 1 file changed, 40 insertions(+), 4 deletions(-)
>
> diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
> index f4f56bc..029106f 100644
> --- a/server/src/api/resources.rs
> +++ b/server/src/api/resources.rs
> @@ -56,6 +56,7 @@ enum MatchCategory {
> Status,
> Template,
> Remote,
> + RemoteType,
> }
>
> impl std::str::FromStr for MatchCategory {
> @@ -69,6 +70,7 @@ impl std::str::FromStr for MatchCategory {
> "status" => MatchCategory::Status,
> "template" => MatchCategory::Template,
> "remote" => MatchCategory::Remote,
> + "remote-type" => MatchCategory::RemoteType,
> _ => bail!("invalid category"),
> };
> Ok(category)
> @@ -88,11 +90,18 @@ impl MatchCategory {
> (Ok(a), Ok(b)) => a == b,
> _ => false,
> },
> + MatchCategory::RemoteType => match (
> + RemoteType::from_str(value),
> + RemoteType::from_str(search_term),
> + ) {
> + (Ok(a), Ok(b)) => a == b,
> + _ => false,
> + },
> }
> }
> }
>
> -// returns None if we can't decide if it matches, currently only for the `Remote` category`
> +// returns None if we can't decide if it matches, currently only for the `RemoteType` category
> fn resource_matches_search_term(
> remote_name: &str,
> resource: &Resource,
> @@ -112,6 +121,7 @@ fn resource_matches_search_term(
> _ => false,
> },
> MatchCategory::Remote => category.matches(remote_name, &term.value),
> + MatchCategory::RemoteType => return None,
> },
> Some(Err(_)) => false,
> None => {
> @@ -122,7 +132,12 @@ fn resource_matches_search_term(
> Some(matches)
> }
>
> -fn remote_matches_search_term(remote_name: &str, online: Option<bool>, term: &SearchTerm) -> bool {
> +fn remote_matches_search_term(
> + remote_name: &str,
> + online: Option<bool>,
> + remote_type: Option<RemoteType>,
> + term: &SearchTerm,
maybe we could just pass '&Remote' here?
then we don't have to add a new parameter in case we want extra info
from the remote in the future?
this would mean that we add a more complete remote struct in the
`RemoteResources` one, but that could help later (see my comment on patch 3)
> +) -> bool {
> match term.category.as_deref().map(|c| c.parse::<MatchCategory>()) {
> Some(Ok(category)) => match category {
> MatchCategory::Type => category.matches("remote", &term.value),
> @@ -135,6 +150,10 @@ fn remote_matches_search_term(remote_name: &str, online: Option<bool>, term: &Se
> None => true,
> },
> MatchCategory::Template => false,
> + MatchCategory::RemoteType => match remote_type {
> + Some(remote_type) => category.matches(&remote_type.to_string(), &term.value),
> + None => true,
> + },
> },
> Some(Err(_)) => false,
> None => {
> @@ -144,6 +163,17 @@ fn remote_matches_search_term(remote_name: &str, online: Option<bool>, term: &Se
> }
> }
>
> +fn remote_type_matches_search_term(remote_type: RemoteType, term: &SearchTerm) -> bool {
> + match term.category.as_deref().map(|c| c.parse::<MatchCategory>()) {
> + Some(Ok(category)) => match category {
> + MatchCategory::RemoteType => category.matches(&remote_type.to_string(), &term.value),
> + _ => true,
> + },
> + Some(Err(_)) => false,
> + None => true,
> + }
> +}
> +
> #[api(
> // FIXME:: see list-like API calls in resource routers, we probably want more fine-grained
> // checks..
> @@ -248,8 +278,14 @@ pub(crate) async fn get_resources_impl(
> }
> }
>
> + if !filters.matches(|term| remote_type_matches_search_term(remote.ty, term)) {
> + continue;
> + }
> +
> if remotes_only
> - && !filters.matches(|term| remote_matches_search_term(&remote_name, None, term))
> + && !filters.matches(|term| {
> + remote_matches_search_term(&remote_name, None, Some(remote.ty), term)
> + })
> {
> continue;
> }
> @@ -301,7 +337,7 @@ pub(crate) async fn get_resources_impl(
> return true;
> }
> filters.matches(|filter| {
> - remote_matches_search_term(&res.remote, Some(res.error.is_none()), filter)
> + remote_matches_search_term(&res.remote, Some(res.error.is_none()), None, filter)
> })
> })
> }
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [pdm-devel] [PATCH datacenter-manager 3/7] server: api: collect failed remotes list while getting status
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 3/7] server: api: collect failed remotes list while getting status Christian Ebner
@ 2025-10-14 8:37 ` Dominik Csapak
2025-10-14 12:41 ` Christian Ebner
0 siblings, 1 reply; 19+ messages in thread
From: Dominik Csapak @ 2025-10-14 8:37 UTC (permalink / raw)
To: Proxmox Datacenter Manager development discussion, Christian Ebner
comments inline
On 10/13/25 10:56 AM, Christian Ebner wrote:
> 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. To get the per-remote-type
> resources, utilize the now previously exposed remote type filtering
> for resources.
>
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
> server/src/api/resources.rs | 105 ++++++++++++++++++++----------------
> 1 file changed, 58 insertions(+), 47 deletions(-)
>
> diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
> index 029106f..33da5c2 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,
> @@ -373,55 +373,66 @@ pub async fn get_status(
> max_age: u64,
> rpcenv: &mut dyn RpcEnvironment,
> ) -> Result<ResourcesStatus, Error> {
> - let remotes = get_resources(max_age, None, None, rpcenv).await?;
> let mut counts = ResourcesStatus::default();
> - for remote in remotes {
> - if remote.error.is_some() {
> - counts.failed_remotes += 1;
> - } else {
> - counts.remotes += 1;
> - }
> - for resource in remote.resources {
> - match resource {
> - Resource::PveStorage(r) => match r.status.as_str() {
> - "available" => counts.storages.available += 1,
> - _ => counts.storages.unknown += 1,
> - },
> - Resource::PveQemu(r) => match r.status.as_str() {
> - _ if r.template => counts.qemu.template += 1,
> - "running" => counts.qemu.running += 1,
> - "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,
> - "stopped" => counts.lxc.stopped += 1,
> - _ => counts.lxc.unknown += 1,
> - },
> - Resource::PveNode(r) => match r.status.as_str() {
> - "online" => counts.pve_nodes.online += 1,
> - "offline" => counts.pve_nodes.offline += 1,
> - _ => counts.pve_nodes.unknown += 1,
> - },
> - Resource::PveSdn(r) => {
> - if let PveSdnResource::Zone(_) = &r {
> - match r.status() {
> - SdnStatus::Available => {
> - counts.sdn_zones.available += 1;
> - }
> - SdnStatus::Error => {
> - counts.sdn_zones.error += 1;
> - }
> - SdnStatus::Unknown => {
> - counts.sdn_zones.unknown += 1;
> + for remote_type in [RemoteType::Pve, RemoteType::Pbs] {
> + let remote_type_search =
> + SearchTerm::new(remote_type.to_string()).category(Some("remote-type"));
> + let remote_type_search = remote_type_search.to_string();
> + let remotes =
> + get_resources_impl(max_age, Some(remote_type_search), None, Some(rpcenv)).await?;
if the `RemoteResources` struct had the complete (or at least more than
the name) struct of the remote, we could keep the current structure of
just looping over that result instead of manually crafting a search
for each type
which would also make the patch diff itself a lot smaller i think
> + for remote in remotes {
> + if let Some(err) = remote.error {
> + counts.failed_remotes += 1;
> + counts.failed_remotes_list.push(FailedRemote {
> + name: remote.remote,
> + error: err.to_string(),
> + remote_type,
> + });
> + } else {
> + counts.remotes += 1;
> + }
> + for resource in remote.resources {
> + match resource {
> + Resource::PveStorage(r) => match r.status.as_str() {
> + "available" => counts.storages.available += 1,
> + _ => counts.storages.unknown += 1,
> + },
> + Resource::PveQemu(r) => match r.status.as_str() {
> + _ if r.template => counts.qemu.template += 1,
> + "running" => counts.qemu.running += 1,
> + "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,
> + "stopped" => counts.lxc.stopped += 1,
> + _ => counts.lxc.unknown += 1,
> + },
> + Resource::PveNode(r) => match r.status.as_str() {
> + "online" => counts.pve_nodes.online += 1,
> + "offline" => counts.pve_nodes.offline += 1,
> + _ => counts.pve_nodes.unknown += 1,
> + },
> + Resource::PveSdn(r) => {
> + if let PveSdnResource::Zone(_) = &r {
> + match r.status() {
> + SdnStatus::Available => {
> + counts.sdn_zones.available += 1;
> + }
> + SdnStatus::Error => {
> + counts.sdn_zones.error += 1;
> + }
> + SdnStatus::Unknown => {
> + counts.sdn_zones.unknown += 1;
> + }
> }
> }
> }
> + // FIXME better status for pbs/datastores
> + Resource::PbsNode(_) => counts.pbs_nodes.online += 1,
> + Resource::PbsDatastore(_) => counts.pbs_datastores.available += 1,
> }
> - // FIXME better status for pbs/datastores
> - Resource::PbsNode(_) => counts.pbs_nodes.online += 1,
> - Resource::PbsDatastore(_) => counts.pbs_datastores.available += 1,
> }
> }
> }
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [pdm-devel] [PATCH datacenter-manager 5/7] ui: dashboard: distinguish failed remotes based on remote type
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 5/7] ui: dashboard: distinguish failed remotes based on " Christian Ebner
@ 2025-10-14 8:47 ` Dominik Csapak
2025-10-14 9:20 ` Christian Ebner
0 siblings, 1 reply; 19+ messages in thread
From: Dominik Csapak @ 2025-10-14 8:47 UTC (permalink / raw)
To: Proxmox Datacenter Manager development discussion, Christian Ebner
more of a high level comment regarding the node dashboard component, but
it fits here as well as the previous patch:
i believe we should rethink how we propagate the information
to this panel, so that we don't have to extract the correct information
inside
e.g. either we restructure the api call/data in a way to separate
the info by type in the first place, or we do that directly
after the api call.
either way I'd probably give this panel just a simple struct
with the necessary information to display
I think this would make it a bit easier to follow and less
like that we forget to e.g. check the type for the content
what do you say?
On 10/13/25 10:56 AM, Christian Ebner wrote:
> The status information api call has been extended to include type and
> error information.
> Use this information to distinguish how to show the respective node
> status message. The number of failed remotes does not take into account
> which type it is, so use the failed nodes list to filter for the
> respective remote. Further, as a PVE node can have multiple nodes while
> the PBS remote is limited to one node, so discriminate that in the
> status as well.
>
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
> ui/src/dashboard/mod.rs | 27 +++++++++++++++++++++------
> 1 file changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs
> index ff63f6a..da62262 100644
> --- a/ui/src/dashboard/mod.rs
> +++ b/ui/src/dashboard/mod.rs
> @@ -27,7 +27,7 @@ use pwt::{
>
> use pdm_api_types::{
> remotes::RemoteType,
> - resource::{NodeStatusCount, ResourcesStatus},
> + resource::{FailedRemote, NodeStatusCount, ResourcesStatus},
> TaskStatistics,
> };
> use pdm_client::types::TopEntity;
> @@ -195,11 +195,26 @@ impl PdmDashboard {
> tr!("{0} nodes have an unknown status", unknown),
> )
> }
> - // FIXME, get more detailed status about the failed remotes (name, type, error)?
> - NodeStatusCount { online, .. } if status.failed_remotes > 0 => (
> - Status::Unknown.into(),
> - tr!("{0} of an unknown number of nodes online", online),
> - ),
> + NodeStatusCount { online, .. } if status.failed_remotes > 0 => {
> + let failed_remotes: Vec<&FailedRemote> = status
> + .failed_remotes_list
> + .iter()
> + .filter(|item| item.remote_type == remote_type)
> + .collect();
> + if failed_remotes.is_empty() {
> + (Status::Success.into(), tr!("{0} nodes online", online))
> + } else if remote_type == RemoteType::Pbs {
> + (
> + Status::Error.into(),
> + tr!("{0} remotes failed", failed_remotes.len()),
> + )
> + } else {
> + (
> + Status::Unknown.into(),
> + tr!("{0} of an unknown number of nodes online", online),
> + )
> + }
> + }
> NodeStatusCount { online, .. } => {
> (Status::Success.into(), tr!("{0} nodes online", online))
> }
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [pdm-devel] [PATCH datacenter-manager 1/7] server: api: add remote-type search category for resources
2025-10-14 8:35 ` Dominik Csapak
@ 2025-10-14 9:01 ` Christian Ebner
0 siblings, 0 replies; 19+ messages in thread
From: Christian Ebner @ 2025-10-14 9:01 UTC (permalink / raw)
To: Dominik Csapak, Proxmox Datacenter Manager development discussion
On 10/14/25 10:35 AM, Dominik Csapak wrote:
> one comment inline
>
> On 10/13/25 10:56 AM, Christian Ebner wrote:
>> Extend the current search capability for resources by adding the
>> `RemoteType` search category, allowing to selectively filter remotes
>> of type PVE and PBS. While extending the search capabilities, this
>> will also be used to filter the resources to be gathered on status
>> api calls, to refine statistics based on remote type.
>>
>> Since the current remote filtering is only applied in case of remotes
>> only search, add an additional helper to pre-filter the to be fetched
>> resources by the remote type.
>>
>> With this it is now possible to search, e.g. `remote-type:pbs` to
>> only get resources from PBS remotes.
>>
>> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
>> ---
>> server/src/api/resources.rs | 44 +++++++++++++++++++++++++++++++++----
>> 1 file changed, 40 insertions(+), 4 deletions(-)
>>
>> diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
>> index f4f56bc..029106f 100644
>> --- a/server/src/api/resources.rs
>> +++ b/server/src/api/resources.rs
>> @@ -56,6 +56,7 @@ enum MatchCategory {
>> Status,
>> Template,
>> Remote,
>> + RemoteType,
>> }
>> impl std::str::FromStr for MatchCategory {
>> @@ -69,6 +70,7 @@ impl std::str::FromStr for MatchCategory {
>> "status" => MatchCategory::Status,
>> "template" => MatchCategory::Template,
>> "remote" => MatchCategory::Remote,
>> + "remote-type" => MatchCategory::RemoteType,
>> _ => bail!("invalid category"),
>> };
>> Ok(category)
>> @@ -88,11 +90,18 @@ impl MatchCategory {
>> (Ok(a), Ok(b)) => a == b,
>> _ => false,
>> },
>> + MatchCategory::RemoteType => match (
>> + RemoteType::from_str(value),
>> + RemoteType::from_str(search_term),
>> + ) {
>> + (Ok(a), Ok(b)) => a == b,
>> + _ => false,
>> + },
>> }
>> }
>> }
>> -// returns None if we can't decide if it matches, currently only for
>> the `Remote` category`
>> +// returns None if we can't decide if it matches, currently only for
>> the `RemoteType` category
>> fn resource_matches_search_term(
>> remote_name: &str,
>> resource: &Resource,
>> @@ -112,6 +121,7 @@ fn resource_matches_search_term(
>> _ => false,
>> },
>> MatchCategory::Remote => category.matches(remote_name,
>> &term.value),
>> + MatchCategory::RemoteType => return None,
>> },
>> Some(Err(_)) => false,
>> None => {
>> @@ -122,7 +132,12 @@ fn resource_matches_search_term(
>> Some(matches)
>> }
>> -fn remote_matches_search_term(remote_name: &str, online:
>> Option<bool>, term: &SearchTerm) -> bool {
>> +fn remote_matches_search_term(
>> + remote_name: &str,
>> + online: Option<bool>,
>> + remote_type: Option<RemoteType>,
>> + term: &SearchTerm,
>
> maybe we could just pass '&Remote' here?
> then we don't have to add a new parameter in case we want extra info
> from the remote in the future?
Yes, makes sense to already have that in place. Will see to adapt that
accordingly.
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [pdm-devel] [PATCH datacenter-manager 5/7] ui: dashboard: distinguish failed remotes based on remote type
2025-10-14 8:47 ` Dominik Csapak
@ 2025-10-14 9:20 ` Christian Ebner
2025-10-14 9:24 ` Dominik Csapak
0 siblings, 1 reply; 19+ messages in thread
From: Christian Ebner @ 2025-10-14 9:20 UTC (permalink / raw)
To: Dominik Csapak, Proxmox Datacenter Manager development discussion
On 10/14/25 10:47 AM, Dominik Csapak wrote:
> more of a high level comment regarding the node dashboard component, but
> it fits here as well as the previous patch:
>
> i believe we should rethink how we propagate the information
> to this panel, so that we don't have to extract the correct information
> inside
>
> e.g. either we restructure the api call/data in a way to separate
> the info by type in the first place, or we do that directly
> after the api call.
>
> either way I'd probably give this panel just a simple struct
> with the necessary information to display
>
> I think this would make it a bit easier to follow and less
> like that we forget to e.g. check the type for the content
>
> what do you say?
Yes, agreed. Will keep the panel input data as simple as possible then.
Fetching the status by remote type would be an option, but at the cost
of an additional API call. Also the return data is already laid out to
be cumulative over remote type variants.
Therefore, maybe better to do the splitting of the remote type specific
information after getting the status?
Finally, splitting the `status` endpoint return data by type is nor
really an option, since that would be a breaking API change, so better
avoided.
Thanks a lot for your comments!
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [pdm-devel] [PATCH datacenter-manager 5/7] ui: dashboard: distinguish failed remotes based on remote type
2025-10-14 9:20 ` Christian Ebner
@ 2025-10-14 9:24 ` Dominik Csapak
0 siblings, 0 replies; 19+ messages in thread
From: Dominik Csapak @ 2025-10-14 9:24 UTC (permalink / raw)
To: Christian Ebner, Proxmox Datacenter Manager development discussion
On 10/14/25 11:19 AM, Christian Ebner wrote:
> On 10/14/25 10:47 AM, Dominik Csapak wrote:
>> more of a high level comment regarding the node dashboard component, but
>> it fits here as well as the previous patch:
>>
>> i believe we should rethink how we propagate the information
>> to this panel, so that we don't have to extract the correct information
>> inside
>>
>> e.g. either we restructure the api call/data in a way to separate
>> the info by type in the first place, or we do that directly
>> after the api call.
>>
>> either way I'd probably give this panel just a simple struct
>> with the necessary information to display
>>
>> I think this would make it a bit easier to follow and less
>> like that we forget to e.g. check the type for the content
>>
>> what do you say?
>
> Yes, agreed. Will keep the panel input data as simple as possible then.
>
>
> Fetching the status by remote type would be an option, but at the cost
> of an additional API call. Also the return data is already laid out to
> be cumulative over remote type variants.
i'd like to avoid more api calls if possible/sensible
>
> Therefore, maybe better to do the splitting of the remote type specific
> information after getting the status?
sound good to me
>
> Finally, splitting the `status` endpoint return data by type is nor
> really an option, since that would be a breaking API change, so better
> avoided.
since we're still in beta, this is not that much of a concern though
>
> Thanks a lot for your comments!
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [pdm-devel] [PATCH datacenter-manager 3/7] server: api: collect failed remotes list while getting status
2025-10-14 8:37 ` Dominik Csapak
@ 2025-10-14 12:41 ` Christian Ebner
2025-10-14 12:53 ` Dominik Csapak
0 siblings, 1 reply; 19+ messages in thread
From: Christian Ebner @ 2025-10-14 12:41 UTC (permalink / raw)
To: Dominik Csapak, Proxmox Datacenter Manager development discussion
On 10/14/25 10:37 AM, Dominik Csapak wrote:
> comments inline
>
> On 10/13/25 10:56 AM, Christian Ebner wrote:
>> 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. To get the per-remote-type
>> resources, utilize the now previously exposed remote type filtering
>> for resources.
>>
>> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
>> ---
>> server/src/api/resources.rs | 105 ++++++++++++++++++++----------------
>> 1 file changed, 58 insertions(+), 47 deletions(-)
>>
>> diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
>> index 029106f..33da5c2 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,
>> @@ -373,55 +373,66 @@ pub async fn get_status(
>> max_age: u64,
>> rpcenv: &mut dyn RpcEnvironment,
>> ) -> Result<ResourcesStatus, Error> {
>> - let remotes = get_resources(max_age, None, None, rpcenv).await?;
>> let mut counts = ResourcesStatus::default();
>> - for remote in remotes {
>> - if remote.error.is_some() {
>> - counts.failed_remotes += 1;
>> - } else {
>> - counts.remotes += 1;
>> - }
>> - for resource in remote.resources {
>> - match resource {
>> - Resource::PveStorage(r) => match r.status.as_str() {
>> - "available" => counts.storages.available += 1,
>> - _ => counts.storages.unknown += 1,
>> - },
>> - Resource::PveQemu(r) => match r.status.as_str() {
>> - _ if r.template => counts.qemu.template += 1,
>> - "running" => counts.qemu.running += 1,
>> - "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,
>> - "stopped" => counts.lxc.stopped += 1,
>> - _ => counts.lxc.unknown += 1,
>> - },
>> - Resource::PveNode(r) => match r.status.as_str() {
>> - "online" => counts.pve_nodes.online += 1,
>> - "offline" => counts.pve_nodes.offline += 1,
>> - _ => counts.pve_nodes.unknown += 1,
>> - },
>> - Resource::PveSdn(r) => {
>> - if let PveSdnResource::Zone(_) = &r {
>> - match r.status() {
>> - SdnStatus::Available => {
>> - counts.sdn_zones.available += 1;
>> - }
>> - SdnStatus::Error => {
>> - counts.sdn_zones.error += 1;
>> - }
>> - SdnStatus::Unknown => {
>> - counts.sdn_zones.unknown += 1;
>> + for remote_type in [RemoteType::Pve, RemoteType::Pbs] {
>> + let remote_type_search =
>> +
>> SearchTerm::new(remote_type.to_string()).category(Some("remote-type"));
>> + let remote_type_search = remote_type_search.to_string();
>> + let remotes =
>> + get_resources_impl(max_age, Some(remote_type_search),
>> None, Some(rpcenv)).await?;
>
>
> if the `RemoteResources` struct had the complete (or at least more than
> the name) struct of the remote, we could keep the current structure of
> just looping over that result instead of manually crafting a search
> for each type
>
> which would also make the patch diff itself a lot smaller i think
That will not work though? The whole point of looping over the remote
types here is to have it in case of an error state, allowing to add the
failed remote including it's type.
So adding that additional information to the RemoteResouces does not
solve that issue, and I would rather opt to keep the iteration here.
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [pdm-devel] [PATCH datacenter-manager 3/7] server: api: collect failed remotes list while getting status
2025-10-14 12:41 ` Christian Ebner
@ 2025-10-14 12:53 ` Dominik Csapak
2025-10-14 13:10 ` Christian Ebner
0 siblings, 1 reply; 19+ messages in thread
From: Dominik Csapak @ 2025-10-14 12:53 UTC (permalink / raw)
To: Christian Ebner, Proxmox Datacenter Manager development discussion
On 10/14/25 2:41 PM, Christian Ebner wrote:
> On 10/14/25 10:37 AM, Dominik Csapak wrote:
>> comments inline
>>
>> On 10/13/25 10:56 AM, Christian Ebner wrote:
>>> 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. To get the per-remote-type
>>> resources, utilize the now previously exposed remote type filtering
>>> for resources.
>>>
>>> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
>>> ---
>>> server/src/api/resources.rs | 105 ++++++++++++++++++++----------------
>>> 1 file changed, 58 insertions(+), 47 deletions(-)
>>>
>>> diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
>>> index 029106f..33da5c2 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,
>>> @@ -373,55 +373,66 @@ pub async fn get_status(
>>> max_age: u64,
>>> rpcenv: &mut dyn RpcEnvironment,
>>> ) -> Result<ResourcesStatus, Error> {
>>> - let remotes = get_resources(max_age, None, None, rpcenv).await?;
>>> let mut counts = ResourcesStatus::default();
>>> - for remote in remotes {
>>> - if remote.error.is_some() {
>>> - counts.failed_remotes += 1;
>>> - } else {
>>> - counts.remotes += 1;
>>> - }
>>> - for resource in remote.resources {
>>> - match resource {
>>> - Resource::PveStorage(r) => match r.status.as_str() {
>>> - "available" => counts.storages.available += 1,
>>> - _ => counts.storages.unknown += 1,
>>> - },
>>> - Resource::PveQemu(r) => match r.status.as_str() {
>>> - _ if r.template => counts.qemu.template += 1,
>>> - "running" => counts.qemu.running += 1,
>>> - "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,
>>> - "stopped" => counts.lxc.stopped += 1,
>>> - _ => counts.lxc.unknown += 1,
>>> - },
>>> - Resource::PveNode(r) => match r.status.as_str() {
>>> - "online" => counts.pve_nodes.online += 1,
>>> - "offline" => counts.pve_nodes.offline += 1,
>>> - _ => counts.pve_nodes.unknown += 1,
>>> - },
>>> - Resource::PveSdn(r) => {
>>> - if let PveSdnResource::Zone(_) = &r {
>>> - match r.status() {
>>> - SdnStatus::Available => {
>>> - counts.sdn_zones.available += 1;
>>> - }
>>> - SdnStatus::Error => {
>>> - counts.sdn_zones.error += 1;
>>> - }
>>> - SdnStatus::Unknown => {
>>> - counts.sdn_zones.unknown += 1;
>>> + for remote_type in [RemoteType::Pve, RemoteType::Pbs] {
>>> + let remote_type_search =
>>> + SearchTerm::new(remote_type.to_string()).category(Some("remote-
>>> type"));
>>> + let remote_type_search = remote_type_search.to_string();
>>> + let remotes =
>>> + get_resources_impl(max_age, Some(remote_type_search),
>>> None, Some(rpcenv)).await?;
>>
>>
>> if the `RemoteResources` struct had the complete (or at least more than
>> the name) struct of the remote, we could keep the current structure of
>> just looping over that result instead of manually crafting a search
>> for each type
>>
>> which would also make the patch diff itself a lot smaller i think
>
> That will not work though? The whole point of looping over the remote
> types here is to have it in case of an error state, allowing to add the
> failed remote including it's type.
>
> So adding that additional information to the RemoteResouces does not
> solve that issue, and I would rather opt to keep the iteration here.
i meant that in `get_resources_impl` we already iterate over all remotes
to collect the info.
instead of just saving the name per remote we could add more info
(like the type) so
instead of
---8<---
RemoteResources {
remote: remote_name,
resources,
error,
}
--->8---
we could do
---8<---
RemoteResources {
remote,
resources,
error,
}
--->8---
where `remote` is some struct that also holds the remote-type info?
then we can simply loop over these and extract the type directly from
that
or am I missing something here?
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [pdm-devel] [PATCH datacenter-manager 3/7] server: api: collect failed remotes list while getting status
2025-10-14 12:53 ` Dominik Csapak
@ 2025-10-14 13:10 ` Christian Ebner
2025-10-14 13:17 ` Dominik Csapak
0 siblings, 1 reply; 19+ messages in thread
From: Christian Ebner @ 2025-10-14 13:10 UTC (permalink / raw)
To: Dominik Csapak, Proxmox Datacenter Manager development discussion
On 10/14/25 2:53 PM, Dominik Csapak wrote:
>
>
> On 10/14/25 2:41 PM, Christian Ebner wrote:
>> On 10/14/25 10:37 AM, Dominik Csapak wrote:
>>> comments inline
>>>
>>> On 10/13/25 10:56 AM, Christian Ebner wrote:
>>>> 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. To get the per-remote-type
>>>> resources, utilize the now previously exposed remote type filtering
>>>> for resources.
>>>>
>>>> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
>>>> ---
>>>> server/src/api/resources.rs | 105 +++++++++++++++++++
>>>> +----------------
>>>> 1 file changed, 58 insertions(+), 47 deletions(-)
>>>>
>>>> diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
>>>> index 029106f..33da5c2 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,
>>>> @@ -373,55 +373,66 @@ pub async fn get_status(
>>>> max_age: u64,
>>>> rpcenv: &mut dyn RpcEnvironment,
>>>> ) -> Result<ResourcesStatus, Error> {
>>>> - let remotes = get_resources(max_age, None, None, rpcenv).await?;
>>>> let mut counts = ResourcesStatus::default();
>>>> - for remote in remotes {
>>>> - if remote.error.is_some() {
>>>> - counts.failed_remotes += 1;
>>>> - } else {
>>>> - counts.remotes += 1;
>>>> - }
>>>> - for resource in remote.resources {
>>>> - match resource {
>>>> - Resource::PveStorage(r) => match r.status.as_str() {
>>>> - "available" => counts.storages.available += 1,
>>>> - _ => counts.storages.unknown += 1,
>>>> - },
>>>> - Resource::PveQemu(r) => match r.status.as_str() {
>>>> - _ if r.template => counts.qemu.template += 1,
>>>> - "running" => counts.qemu.running += 1,
>>>> - "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,
>>>> - "stopped" => counts.lxc.stopped += 1,
>>>> - _ => counts.lxc.unknown += 1,
>>>> - },
>>>> - Resource::PveNode(r) => match r.status.as_str() {
>>>> - "online" => counts.pve_nodes.online += 1,
>>>> - "offline" => counts.pve_nodes.offline += 1,
>>>> - _ => counts.pve_nodes.unknown += 1,
>>>> - },
>>>> - Resource::PveSdn(r) => {
>>>> - if let PveSdnResource::Zone(_) = &r {
>>>> - match r.status() {
>>>> - SdnStatus::Available => {
>>>> - counts.sdn_zones.available += 1;
>>>> - }
>>>> - SdnStatus::Error => {
>>>> - counts.sdn_zones.error += 1;
>>>> - }
>>>> - SdnStatus::Unknown => {
>>>> - counts.sdn_zones.unknown += 1;
>>>> + for remote_type in [RemoteType::Pve, RemoteType::Pbs] {
>>>> + let remote_type_search =
>>>> + SearchTerm::new(remote_type.to_string()).category(Some("remote-
>>>> type"));
>>>> + let remote_type_search = remote_type_search.to_string();
>>>> + let remotes =
>>>> + get_resources_impl(max_age, Some(remote_type_search),
>>>> None, Some(rpcenv)).await?;
>>>
>>>
>>> if the `RemoteResources` struct had the complete (or at least more than
>>> the name) struct of the remote, we could keep the current structure
>>> of just looping over that result instead of manually crafting a search
>>> for each type
>>>
>>> which would also make the patch diff itself a lot smaller i think
>>
>> That will not work though? The whole point of looping over the remote
>> types here is to have it in case of an error state, allowing to add
>> the failed remote including it's type.
>>
>> So adding that additional information to the RemoteResouces does not
>> solve that issue, and I would rather opt to keep the iteration here.
>
> i meant that in `get_resources_impl` we already iterate over all remotes
> to collect the info.
>
> instead of just saving the name per remote we could add more info
> (like the type) so
>
> instead of
> ---8<---
> RemoteResources {
> remote: remote_name,
> resources,
> error,
> }
> --->8---
>
> we could do
>
> ---8<---
> RemoteResources {
> remote,
> resources,
> error,
> }
> --->8---
>
> where `remote` is some struct that also holds the remote-type info?
>
> then we can simply loop over these and extract the type directly from
> that
>
>
> or am I missing something here?
Ah, I see what you mean now! However adding the full remote is not
really an option as this would leak secrets from the remote config. I
could of course extend the RemoteResource by the remote type only, but
that would pollute this API response type with unneeded additional data,
which I would like to avoid unless there is another usecase for this?
I think it is probably best to use an internal return type or tuple for
the get_resources_impl only, dropping the non RemoteResource part when
returned by api calls.
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [pdm-devel] [PATCH datacenter-manager 3/7] server: api: collect failed remotes list while getting status
2025-10-14 13:10 ` Christian Ebner
@ 2025-10-14 13:17 ` Dominik Csapak
0 siblings, 0 replies; 19+ messages in thread
From: Dominik Csapak @ 2025-10-14 13:17 UTC (permalink / raw)
To: Christian Ebner, Proxmox Datacenter Manager development discussion
On 10/14/25 3:09 PM, Christian Ebner wrote:
> On 10/14/25 2:53 PM, Dominik Csapak wrote:
>>
>>
>> On 10/14/25 2:41 PM, Christian Ebner wrote:
>>> On 10/14/25 10:37 AM, Dominik Csapak wrote:
>>>> comments inline
>>>>
>>>> On 10/13/25 10:56 AM, Christian Ebner wrote:
>>>>> 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. To get the per-remote-type
>>>>> resources, utilize the now previously exposed remote type filtering
>>>>> for resources.
>>>>>
>>>>> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
>>>>> ---
>>>>> server/src/api/resources.rs | 105 +++++++++++++++++++
>>>>> +----------------
>>>>> 1 file changed, 58 insertions(+), 47 deletions(-)
>>>>>
>>>>> diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
>>>>> index 029106f..33da5c2 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,
>>>>> @@ -373,55 +373,66 @@ pub async fn get_status(
>>>>> max_age: u64,
>>>>> rpcenv: &mut dyn RpcEnvironment,
>>>>> ) -> Result<ResourcesStatus, Error> {
>>>>> - let remotes = get_resources(max_age, None, None, rpcenv).await?;
>>>>> let mut counts = ResourcesStatus::default();
>>>>> - for remote in remotes {
>>>>> - if remote.error.is_some() {
>>>>> - counts.failed_remotes += 1;
>>>>> - } else {
>>>>> - counts.remotes += 1;
>>>>> - }
>>>>> - for resource in remote.resources {
>>>>> - match resource {
>>>>> - Resource::PveStorage(r) => match r.status.as_str() {
>>>>> - "available" => counts.storages.available += 1,
>>>>> - _ => counts.storages.unknown += 1,
>>>>> - },
>>>>> - Resource::PveQemu(r) => match r.status.as_str() {
>>>>> - _ if r.template => counts.qemu.template += 1,
>>>>> - "running" => counts.qemu.running += 1,
>>>>> - "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,
>>>>> - "stopped" => counts.lxc.stopped += 1,
>>>>> - _ => counts.lxc.unknown += 1,
>>>>> - },
>>>>> - Resource::PveNode(r) => match r.status.as_str() {
>>>>> - "online" => counts.pve_nodes.online += 1,
>>>>> - "offline" => counts.pve_nodes.offline += 1,
>>>>> - _ => counts.pve_nodes.unknown += 1,
>>>>> - },
>>>>> - Resource::PveSdn(r) => {
>>>>> - if let PveSdnResource::Zone(_) = &r {
>>>>> - match r.status() {
>>>>> - SdnStatus::Available => {
>>>>> - counts.sdn_zones.available += 1;
>>>>> - }
>>>>> - SdnStatus::Error => {
>>>>> - counts.sdn_zones.error += 1;
>>>>> - }
>>>>> - SdnStatus::Unknown => {
>>>>> - counts.sdn_zones.unknown += 1;
>>>>> + for remote_type in [RemoteType::Pve, RemoteType::Pbs] {
>>>>> + let remote_type_search =
>>>>> + SearchTerm::new(remote_type.to_string()).category(Some("remote-
>>>>> type"));
>>>>> + let remote_type_search = remote_type_search.to_string();
>>>>> + let remotes =
>>>>> + get_resources_impl(max_age, Some(remote_type_search),
>>>>> None, Some(rpcenv)).await?;
>>>>
>>>>
>>>> if the `RemoteResources` struct had the complete (or at least more than
>>>> the name) struct of the remote, we could keep the current structure
>>>> of just looping over that result instead of manually crafting a search
>>>> for each type
>>>>
>>>> which would also make the patch diff itself a lot smaller i think
>>>
>>> That will not work though? The whole point of looping over the remote
>>> types here is to have it in case of an error state, allowing to add
>>> the failed remote including it's type.
>>>
>>> So adding that additional information to the RemoteResouces does not
>>> solve that issue, and I would rather opt to keep the iteration here.
>>
>> i meant that in `get_resources_impl` we already iterate over all remotes
>> to collect the info.
>>
>> instead of just saving the name per remote we could add more info
>> (like the type) so
>>
>> instead of
>> ---8<---
>> RemoteResources {
>> remote: remote_name,
>> resources,
>> error,
>> }
>> --->8---
>>
>> we could do
>>
>> ---8<---
>> RemoteResources {
>> remote,
>> resources,
>> error,
>> }
>> --->8---
>>
>> where `remote` is some struct that also holds the remote-type info?
>>
>> then we can simply loop over these and extract the type directly from
>> that
>>
>>
>> or am I missing something here?
>
> Ah, I see what you mean now! However adding the full remote is not
> really an option as this would leak secrets from the remote config. I
> could of course extend the RemoteResource by the remote type only, but
> that would pollute this API response type with unneeded additional data,
> which I would like to avoid unless there is another usecase for this?
>
> I think it is probably best to use an internal return type or tuple for
> the get_resources_impl only, dropping the non RemoteResource part when
> returned by api calls.
while I don't think that adding the type here is very "polluting", I'm
fine with having some kind of intermediary type + dropping it for the api
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* [pdm-devel] superseded: [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard
2025-10-13 8:56 [pdm-devel] [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard Christian Ebner
` (6 preceding siblings ...)
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 7/7] ui: dashboard: filter by remote type for PVE and PBS node " Christian Ebner
@ 2025-10-17 14:13 ` Christian Ebner
7 siblings, 0 replies; 19+ messages in thread
From: Christian Ebner @ 2025-10-17 14:13 UTC (permalink / raw)
To: pdm-devel
superseded-by version 2:
https://lore.proxmox.com/pdm-devel/20251017141137.845295-1-c.ebner@proxmox.com/T/
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2025-10-17 14:12 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-13 8:56 [pdm-devel] [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard Christian Ebner
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 1/7] server: api: add remote-type search category for resources Christian Ebner
2025-10-14 8:35 ` Dominik Csapak
2025-10-14 9:01 ` Christian Ebner
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 2/7] pdm-api-types: extend resource status by list of failed remotes Christian Ebner
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 3/7] server: api: collect failed remotes list while getting status Christian Ebner
2025-10-14 8:37 ` Dominik Csapak
2025-10-14 12:41 ` Christian Ebner
2025-10-14 12:53 ` Dominik Csapak
2025-10-14 13:10 ` Christian Ebner
2025-10-14 13:17 ` Dominik Csapak
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 4/7] ui: dashboard: extend node panel creation by remote type Christian Ebner
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 5/7] ui: dashboard: distinguish failed remotes based on " Christian Ebner
2025-10-14 8:47 ` Dominik Csapak
2025-10-14 9:20 ` Christian Ebner
2025-10-14 9:24 ` Dominik Csapak
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 6/7] ui: dashboard: expose PBS nodes status panel Christian Ebner
2025-10-13 8:56 ` [pdm-devel] [PATCH datacenter-manager 7/7] ui: dashboard: filter by remote type for PVE and PBS node " Christian Ebner
2025-10-17 14:13 ` [pdm-devel] superseded: [PATCH datacenter-manager 0/7] add remote type based search and PBS node status panel to dashboard Christian Ebner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox