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.gol...@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 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel