From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id D9E621FF136 for ; Mon, 09 Mar 2026 13:24:59 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 192A931DD9; Mon, 9 Mar 2026 13:24:52 +0100 (CET) Date: Mon, 9 Mar 2026 13:24:15 +0100 From: Gabriel Goller To: Hannes Laimer Subject: Re: [PATCH pve-network v4 9/9] api: add dry-run endpoint for sdn apply to preview changes Message-ID: <5m5rrizwdaihgzxe5gfalm5fbczrr3cq77lribknjr4ps3cmj5@glrjl4nff5bw> Mail-Followup-To: Hannes Laimer , pve-devel@lists.proxmox.com References: <20260306125315.190298-1-g.goller@proxmox.com> <20260306125315.190298-19-g.goller@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20241002-35-39f9a6 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1773059023906 X-SPAM-LEVEL: Spam detection results: 0 AWL -1.052 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.408 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.819 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.903 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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: 3LANQ2NLXPV6GM6L3M7BCBY4VZO7DPQT X-Message-ID-Hash: 3LANQ2NLXPV6GM6L3M7BCBY4VZO7DPQT X-MailFrom: g.goller@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: On 06.03.2026 18:13, Hannes Laimer wrote: > nit inline > > On 2026-03-06 13:54, Gabriel Goller wrote: > > Allows users to see the diff of frr and interfaces configuration files > > before applying SDN changes. Previously this was not possible and the > > user had to apply and then see what changed. For the ifupdown2 dry-run > > to work, pull out the running_config generation to the parent functions. > > > > Also add an option to the compile_running_cfg function so that we can > > skip the /etc/network/interfaces.d/sdn file version bump. This means > > when nothing has been changed and dry-run is pressed, nothing will be > > shown. > > > > Rename a few constants so that they don't clash with local variables. > > > > Signed-off-by: Gabriel Goller > > --- > > src/PVE/API2/Network/SDN.pm | 88 ++++++++++++++++++++++++++++++++ > > src/PVE/Network/SDN.pm | 36 ++++++++----- > > src/PVE/Network/SDN/Fabrics.pm | 10 +++- > > src/PVE/Network/SDN/Zones.pm | 3 +- > > src/test/debug/generateconfig.pl | 3 +- > > src/test/run_test_zones.pl | 2 +- > > 6 files changed, 124 insertions(+), 18 deletions(-) > > > > diff --git a/src/PVE/API2/Network/SDN.pm b/src/PVE/API2/Network/SDN.pm > > index b35a588d391d..b98bc9146004 100644 > > --- a/src/PVE/API2/Network/SDN.pm > > +++ b/src/PVE/API2/Network/SDN.pm > > @@ -3,6 +3,9 @@ package PVE::API2::Network::SDN; > > use strict; > > use warnings; > > > > [..] > > > + > > +__PACKAGE__->register_method({ > > + name => 'dry-run', > > + path => 'dry-run', > > + method => 'GET', > > + permissions => { > > + check => ['perm', '/nodes/{node}', ['Sys.Modify']], > > very much a nit, and doesn't warrant a v5, but Sys.Audit is probably > more fitting Agree. Can send this out as a follow-up or a separate patch if nothing else comes up? > > + }, > > + description => > > + "Dry-run the SDN apply action and return the difference between the current configuration and the pending configuration", > > + protected => 1, > > + proxyto => 'node', > > + parameters => { > > + additionalProperties => 0, > > + properties => { > > + node => get_standard_option('pve-node'), > > + }, > > + }, > > + > > + returns => { > > + type => 'object', > > + properties => { > > + "frr-diff" => { > > + type => 'string', > > + description => > > + 'The difference between the current and pending FRR configuration.', > > + }, > > + "interfaces-diff" => { > > + type => 'string', > > + description => > > + 'The difference between the current and pending /etc/network/interfaces.d/sdn configuration.', > > + }, > > + }, > > + }, > > [..] > > > > > PVE::Network::SDN::Zones::write_etc_network_config($network_config); > > print "/etc/network/interfaces.d/sdn\n"; > > diff --git a/src/test/run_test_zones.pl b/src/test/run_test_zones.pl > > index 806225735e6b..8986c5c52c9f 100755 > > --- a/src/test/run_test_zones.pl > > +++ b/src/test/run_test_zones.pl > > @@ -145,7 +145,7 @@ foreach my $test (@tests) { > > my $name = $test; > > my $expected = read_file("./$test/expected_sdn_interfaces"); > > > > - my $result = eval { PVE::Network::SDN::generate_raw_etc_network_config() }; > > + my $result = eval { PVE::Network::SDN::generate_raw_etc_network_config($sdn_config) }; > > > > if (my $err = $@) { > > diag("got unexpected error - $err"); >