From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 9903C1FF09F for ; Thu, 03 Sep 2026 11:36:08 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 5FBFB2159E; Thu, 03 Sep 2026 11:36:05 +0200 (CEST) From: Daniel Herzig To: Hannes Laimer Subject: Re: [pve-network v2 1/4] vnets: introduce get_subnets_with_config In-Reply-To: References: <20260831110116.300798-1-d.herzig@proxmox.com> <20260831110116.300798-2-d.herzig@proxmox.com> <87ecfe1hd3.fsf@proxmox.com> Date: Thu, 03 Sep 2026 11:35:58 +0200 Message-ID: <8733vqhe2p.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: 1788428158408 X-SPAM-LEVEL: Spam detection results: 0 AWL 1.488 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: 2MSBR2JIK23MTK7SXXWGXBL7BMGSRDO5 X-Message-ID-Hash: 2MSBR2JIK23MTK7SXXWGXBL7BMGSRDO5 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: Hannes Laimer writes: >> >> --- >> >> src/PVE/Network/SDN/Vnets.pm | 8 +++++++- >> >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> >> >> diff --git a/src/PVE/Network/SDN/Vnets.pm b/src/PVE/Network/SDN/Vnets.pm >> >> index c327a4b..aa2e842 100644 >> >> --- a/src/PVE/Network/SDN/Vnets.pm >> >> +++ b/src/PVE/Network/SDN/Vnets.pm >> >> @@ -70,9 +70,15 @@ sub get_vnet { >> >> sub get_subnets { >> >> my ($vnetid, $running) = @_; >> >> >> >> - my $subnets = undef; >> >> my $subnets_cfg = PVE::Network::SDN::Subnets::config($running); >> >> + return get_subnets_with_config($vnetid, $subnets_cfg); >> >> + >> >> +} >> >> >> >> +sub get_subnets_with_config { >> >> + my ($vnetid, $subnets_cfg) = @_; >> >> + >> > >> > we should probably `die` here if the passed cfg is undef, for the >> > deletion `ids` will be empty, and an empty conf will be generated, >> > that's fine. but we dont want undef here.. >> >> I guess we could possibly also fall back to re-reading >> `/etc/pve/sdn/subnets.cfg` in case anything got lost in transmission, or >> in a disaster-situation, where the file got lost alltogether, fall back >> to get the values from `.running-config` and issue a warning instead of >> `die`-ing here. I need to wrap my head around it, but I'm not sure if >> this is a good place to `die`. >> > > not really, at least i don't think we should. the premis of this sub is, > 'give me a config, and ill get you its subnets', the assertion here is > 'you give me a config'. this should not go and fetch its own.. > I agree, I'll test with the `die` in place and send a v3 without the 'Dhcp.pm' patch. >> > on that note, the guard in >> > Dhcp.pm should maybe be updated >> > >> >> I've sent a separate answer regarding the patch in Dhcp.pm -- in a >> nutshell, we could possibly just skip that one (also, because it's not >> really related to the dry-run topic). >> >> >> >> + 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); >> >> -- >> >> 2.47.3 >> >> >> >>