all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager 1/1] network: improve reloading logic
Date: Tue,  5 Aug 2025 10:29:23 +0200	[thread overview]
Message-ID: <20250805082926.48280-2-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20250805082926.48280-1-s.hanreich@proxmox.com>

The old behavior was *always* reloading the network configuration,
which worked as long as FRR was not pre-installed, but the change in
db03d261 coupled with the fact that we now ship with FRR caused FRR to
be enabled on applying the network configuration via the Web UI.

The stop gap fix in e1b9466d solved this behavior, but had the issue
that we need to possibly regenerate the FRR configuration if the host
configuration changes, since some controllers generate their
configuration based on the host network configuration.

pve-network now always sends the regenerate-frr parameter, so we can
discern whether a request came from SDN or is a manual request that is
requesting a specific behavior. With this information the reloading
logic can be improved as follows:

* Honor the parameter if it is set
* reload only if there are any FRR entities in the SDN configuration

This should handle all cases that we need to consider:

* Do not overwrite existing FRR configurations, unless we need to
  generate our own FRR configuration.

* Do not trigger a FRR enable when reloading the host configuration,
  even though there is no FRR configuration.

* Overwrite the FRR configuration with an empty configuration if all
  SDN entities using FRR got deleted.

* Regenerate the FRR configuration when the host network configuration
  changes, since this might affect the generated FRR configuration.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
 PVE/API2/Network.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
index b423e19b5..28e060714 100644
--- a/PVE/API2/Network.pm
+++ b/PVE/API2/Network.pm
@@ -932,7 +932,13 @@ __PACKAGE__->register_method({
             };
             PVE::Tools::run_command(['ifreload', '-a'], errfunc => $err);
 
-            if ($have_sdn && $regenerate_frr) {
+            if (defined($regenerate_frr)) {
+                # SDN is requesting a reload, so we abide by the parameter set
+                # by SDN>
+                PVE::Network::SDN::generate_frr_config(1) if $regenerate_frr;
+            } elsif (PVE::Network::SDN::running_config_has_frr()) {
+                # Reload is coming from the Web UI, so we reload if there are
+                # FRR entities in the SDN config.
                 PVE::Network::SDN::generate_frr_config(1);
             }
         };
-- 
2.47.2


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2025-08-05  8:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-05  8:29 [pve-devel] [PATCH manager/network 0/2] Improve FRR " Stefan Hanreich
2025-08-05  8:29 ` Stefan Hanreich [this message]
2025-08-05  8:29 ` [pve-devel] [PATCH pve-network 1/1] sdn: api: always send regenerate-frr parameter Stefan Hanreich
2025-08-05  8:57 ` [pve-devel] [PATCH manager/network 0/2] Improve FRR reloading logic Friedrich Weber
2025-08-05  9:11 ` Gabriel Goller

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=20250805082926.48280-2-s.hanreich@proxmox.com \
    --to=s.hanreich@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