public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: Daniel Herzig <d.herzig@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [pve-network 1/2] vnets: introduce get_subnets_with_config
Date: Thu, 27 Aug 2026 15:58:21 +0200	[thread overview]
Message-ID: <157c7399-c2ac-46b1-a7f4-cc6121bab204@proxmox.com> (raw)
In-Reply-To: <20260826154318.618730-1-d.herzig@proxmox.com>

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

> +    return $subnets;
> +}
> +
>  sub get_subnet_from_vnet_ip {
>      my ($vnetid, $ip) = @_;
>  





      parent reply	other threads:[~2026-08-27 13:58 UTC|newest]

Thread overview: 4+ 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-27 13:58 ` Hannes Laimer [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=157c7399-c2ac-46b1-a7f4-cc6121bab204@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=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 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