all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Daniel Herzig <d.herzig@proxmox.com>
To: Hannes Laimer <h.laimer@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-network v2 4/4] dhcp: make use of get_subnets_with_config
Date: Mon, 31 Aug 2026 15:54:38 +0200	[thread overview]
Message-ID: <87ik4q1jkx.fsf@proxmox.com> (raw)
In-Reply-To: <apVyFcWzm4aLAQb7@nana.intra.proxmox.com>

Hannes Laimer <h.laimer@proxmox.com> writes:

> On 2026-08-31 13:01, Daniel Herzig wrote:
>> At the given point we already have the subnet configuration by hand,
>> so make sure to use it, instead of inherently falling back to
>> re-reading '/etc/pve/sdn/.running-config' via the original
>> 'get_subnets($vnet_id, 1)'.
>> 
>
> before this was `get_subnets($vnetid)`, so it did not take it from
> running, now, it does since `$subnet_cfg` is the running config that has
> the changes commited to it. this is a behaviour change, arguably this is
> more correct here.. currently the node PUT `../network` endpoint also
> calls this generate, that applies still pending configs, which is
> probably a bug tbh
>
> so chnage is good, but the commit message should be updated

Thanks for catching this.

I was scanning callers that have `$subnet_cfg` available at calltime and
admittedly missed that we're calling without `$running=1` here.

So this one here is essentially superflouus, without `$running=1` we're
reading from (already updated) '/etc/pve/sdn/subnets.cfg' file via
`Subnets::config` (without `$running` given) anyway. 

ATM, I'm not sure what's better -- calling the original
`get_subnets($vnetid)` without `$running` should yield the same as
`$subnets` as calling `get_subnets_with_config($vnetid,$subnet_cfg)` at
this point.

For general noise reduction reasons I'd think about dropping this patch
altogether, on the other hand, with it, we'd once less look into the
file, which doesn't really seem to be necessary at this point.


>
>> Signed-off-by: Daniel Herzig <d.herzig@proxmox.com>
>> ---
>>  src/PVE/Network/SDN/Dhcp.pm | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/src/PVE/Network/SDN/Dhcp.pm b/src/PVE/Network/SDN/Dhcp.pm
>> index 65e40d4..1fdec89 100644
>> --- a/src/PVE/Network/SDN/Dhcp.pm
>> +++ b/src/PVE/Network/SDN/Dhcp.pm
>> @@ -94,7 +94,7 @@ sub regenerate_config {
>>              next if $vnet->{zone} ne $zoneid;
>>  
>>              my $config = [];
>> -            my $subnets = PVE::Network::SDN::Vnets::get_subnets($vnetid);
>> +            my $subnets = PVE::Network::SDN::Vnets::get_subnets_with_config($vnetid, $subnet_cfg);
>>  
>>              foreach my $subnet_id (sort keys %{$subnets}) {
>>                  my $subnet_config = $subnets->{$subnet_id};
>> -- 
>> 2.47.3
>> 
>> 
>> 
>> 




  reply	other threads:[~2026-08-31 13:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 11:01 [pve-network v2 0/4] make sure to use subnet config if available at point Daniel Herzig
2026-08-31 11:01 ` [pve-network v2 1/4] vnets: introduce get_subnets_with_config Daniel Herzig
2026-08-31 12:55   ` Hannes Laimer
2026-08-31 14:42     ` Daniel Herzig
2026-09-01  7:14       ` Hannes Laimer
2026-09-03  9:35         ` Daniel Herzig
2026-08-31 11:01 ` [pve-network v2 2/4] fix #7837: simpleplugin: make use of get_subnets_with_config Daniel Herzig
2026-08-31 11:01 ` [pve-network v2 3/4] evpnplugin: " Daniel Herzig
2026-08-31 11:01 ` [pve-network v2 4/4] dhcp: " Daniel Herzig
2026-08-31 12:33   ` Hannes Laimer
2026-08-31 13:54     ` Daniel Herzig [this message]
2026-09-01  7:17       ` Hannes Laimer
2026-09-01  8:03 ` [pve-network v2 0/4] make sure to use subnet config if available at point Gabriel Goller
2026-09-03  9:37   ` 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=87ik4q1jkx.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 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