From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id E52E61FF0C5 for ; Fri, 28 Aug 2026 10:35:44 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id E0FCD214C0; Fri, 28 Aug 2026 10:35:43 +0200 (CEST) From: Daniel Herzig To: Hannes Laimer Subject: Re: [pve-network 1/2] vnets: introduce get_subnets_with_config In-Reply-To: <157c7399-c2ac-46b1-a7f4-cc6121bab204@proxmox.com> References: <20260826154318.618730-1-d.herzig@proxmox.com> <157c7399-c2ac-46b1-a7f4-cc6121bab204@proxmox.com> Date: Fri, 28 Aug 2026 10:35:36 +0200 Message-ID: <8733vy63s7.fsf@proxmox.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1787906129581 X-SPAM-LEVEL: Spam detection results: 0 AWL 1.683 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: VBA7RDWFSMYT5KBEU6LDRJAR35AMYTAH X-Message-ID-Hash: VBA7RDWFSMYT5KBEU6LDRJAR35AMYTAH X-MailFrom: d.herzig@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Thanks for looking into this. Hannes Laimer writes: > On 2026-08-26 17:43, Daniel Herzig wrote: >> Add a sub to return the subnets of a vnet with certain subnet configuration given. >> >> Signed-off-by: Daniel Herzig >> --- >> 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; >> + } >> + > > this loop is the same as in `get_subnets`, `get_subnets` could just also > call this helper, so filtering is only done in one place > Thanks for catching this -- I agree that doubling up the procedures here is not nice. Will send a v2 with calling it from the original `get_subnets`. >> + return $subnets; >> +} >> + >> sub get_subnet_from_vnet_ip { >> my ($vnetid, $ip) = @_; >>