From: Daniel Herzig <d.herzig@proxmox.com>
To: Hannes Laimer <h.laimer@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-network 1/2] vnets: introduce get_subnets_with_config
Date: Fri, 28 Aug 2026 10:35:36 +0200 [thread overview]
Message-ID: <8733vy63s7.fsf@proxmox.com> (raw)
In-Reply-To: <157c7399-c2ac-46b1-a7f4-cc6121bab204@proxmox.com>
Thanks for looking into this.
Hannes Laimer <h.laimer@proxmox.com> 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 <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;
>> + }
>> +
>
> 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) = @_;
>>
prev parent reply other threads:[~2026-08-28 8:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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-28 8:41 ` Daniel Herzig
2026-08-27 13:58 ` [pve-network 1/2] vnets: introduce get_subnets_with_config Hannes Laimer
2026-08-28 8:35 ` Daniel Herzig [this message]
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=8733vy63s7.fsf@proxmox.com \
--to=d.herzig@proxmox.com \
--cc=h.laimer@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox