all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Daniel Herzig <d.herzig@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-network 1/2] vnets: introduce get_subnets_with_config
Date: Wed, 26 Aug 2026 17:43:17 +0200	[thread overview]
Message-ID: <20260826154318.618730-1-d.herzig@proxmox.com> (raw)

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




             reply	other threads:[~2026-08-26 15:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 15:43 Daniel Herzig [this message]
2026-08-26 15:43 ` [pve-network 2/2] fix #7837: simpleplugin: make use of get_subnets_with_config Daniel Herzig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260826154318.618730-1-d.herzig@proxmox.com \
    --to=d.herzig@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal