[pve-devel] [PATCH proxmox-ve-rs v3 3/3] ve-config: add helper function to iterate over all nodes in all fabrics

Gabriel Goller g.goller at proxmox.com
Tue Aug 26 11:49:44 CEST 2025


Add helper function to iterate over all nodes in all fabrics. This is
especially useful e.g. when retrieving the stats as we need to find all
the fabrics on the current node (and their node config).

Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---
 proxmox-ve-config/src/sdn/fabric/mod.rs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/proxmox-ve-config/src/sdn/fabric/mod.rs b/proxmox-ve-config/src/sdn/fabric/mod.rs
index 58a06f9423cb..677a30976297 100644
--- a/proxmox-ve-config/src/sdn/fabric/mod.rs
+++ b/proxmox-ve-config/src/sdn/fabric/mod.rs
@@ -618,6 +618,11 @@ impl FabricConfig {
             .ok_or_else(|| FabricConfigError::FabricDoesNotExist(id.to_string()))
     }
 
+    /// Get an iterator over all the nodes in all fabrics.
+    pub fn all_nodes(&self) -> impl Iterator<Item = (&NodeId, &Node)> + '_ {
+        self.values().flat_map(|entry| entry.nodes())
+    }
+
     /// Returns an iterator over mutable references to all [`FabricEntry`] in the config
     pub fn get_fabrics_mut(&mut self) -> impl Iterator<Item = &mut FabricEntry> {
         self.fabrics.values_mut()
-- 
2.47.2





More information about the pve-devel mailing list