From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 39AA61FF13E for ; Fri, 06 Mar 2026 13:08:26 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 977C5302DC; Fri, 6 Mar 2026 13:09:31 +0100 (CET) Date: Fri, 6 Mar 2026 13:08:54 +0100 From: Gabriel Goller To: Stefan Hanreich Subject: Re: [PATCH pve-network v3 9/9] api: add dry-run endpoint for sdn apply to preview changes Message-ID: Mail-Followup-To: Stefan Hanreich , pve-devel@lists.proxmox.com References: <20260305100331.80741-1-g.goller@proxmox.com> <20260305100331.80741-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: 1772798906197 X-SPAM-LEVEL: Spam detection results: 0 AWL -1.056 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.617 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.892 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.622 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: DU3AMRMP42CCTGCO5OFIVEX3O3BKDSBL X-Message-ID-Hash: DU3AMRMP42CCTGCO5OFIVEX3O3BKDSBL 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 10:24, Stefan Hanreich wrote: > On 3/5/26 11:04 AM, 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(-) > > [snip] > > +__PACKAGE__->register_method({ > > + name => 'dry-run', > > + path => 'dry-run', > > + method => 'PUT', > > Should this really be a PUT method? GET would imo be better suited, > since it doesn't have any side-effects. The node param could just be > part of the path instead of sending it in the body. > Done, thanks for the review! > > + permissions => { > > + check => ['perm', '/nodes/{node}', ['Sys.Modify']], > > + }, > > + 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.', > > + }, > > + }, > > [snip]