public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-network 1/2] vnets: introduce get_subnets_with_config
@ 2026-08-26 15:43 Daniel Herzig
  2026-08-26 15:43 ` [pve-network 2/2] fix #7837: simpleplugin: make use of get_subnets_with_config Daniel Herzig
  2026-08-27 13:58 ` [pve-network 1/2] vnets: introduce get_subnets_with_config Hannes Laimer
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Herzig @ 2026-08-26 15:43 UTC (permalink / raw)
  To: pve-devel

Add a sub to return the subnets of a vnet with certain subnet configuration given.

Signed-off-by: Daniel Herzig <d.herzig@proxmox.com>
---
 src/PVE/Network/SDN/Vnets.pm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/PVE/Network/SDN/Vnets.pm b/src/PVE/Network/SDN/Vnets.pm
index c327a4b..fdb2dd9 100644
--- a/src/PVE/Network/SDN/Vnets.pm
+++ b/src/PVE/Network/SDN/Vnets.pm
@@ -82,6 +82,19 @@ sub get_subnets {
     return $subnets;
 }
 
+sub get_subnets_with_config {
+    my ($vnetid, $subnets_cfg) = @_;
+
+    my $subnets = undef;
+    foreach my $subnetid (sort keys %{ $subnets_cfg->{ids} }) {
+        my $subnet = PVE::Network::SDN::Subnets::sdn_subnets_config($subnets_cfg, $subnetid);
+        next if !$subnet->{vnet} || ($vnetid && $subnet->{vnet} ne $vnetid);
+        $subnets->{$subnetid} = $subnet;
+    }
+
+    return $subnets;
+}
+
 sub get_subnet_from_vnet_ip {
     my ($vnetid, $ip) = @_;
 
-- 
2.47.3




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-27 13:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-26 15:43 [pve-network 1/2] vnets: introduce get_subnets_with_config Daniel Herzig
2026-08-26 15:43 ` [pve-network 2/2] fix #7837: simpleplugin: make use of get_subnets_with_config Daniel Herzig
2026-08-27 13:56   ` Hannes Laimer
2026-08-27 13:58 ` [pve-network 1/2] vnets: introduce get_subnets_with_config Hannes Laimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal