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

Stefan Hanreich s.hanreich at proxmox.com
Thu Oct 30 16:48:12 CET 2025


From: Gabriel Goller <g.goller at proxmox.com>

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>
Signed-off-by: Stefan Hanreich <s.hanreich 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 58a06f9..677a309 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.3




More information about the pve-devel mailing list