From: Gabriel Goller <g.gol...@proxmox.com>

With the introduction of fabrics, frr configuration generation and
etc/network/interfaces generation has been reworked and renamed for
better clarity, since now not only zones / controllers are responsible
for generating the ifupdown / FRR configuration. Switch this endpoint
over to use the new functions.

We also add a new skip_frr parameter that skips FRR config generation
if set. With the old FRR config generation logic, we never wrote an
empty FRR configuration if all controllers got deleted. This meant
that deleting all controllers still left the previous FRR
configuration on the nodes, never disabling BGP / IS-IS. The new logic
now writes an empty configuration if there is no controller / fabric
configured, fixing this behavior. This has a side effect for users
with an existing FRR configuration not managed by SDN, but utilizing
other SDN features (zones, vnets, ...). Their manual FRR configuration
would get overwritten when applying an SDN configuration. This is
particularly an issue with full-mesh Ceph setups, that were set up
according to our Wiki guide [1]. User with such a full-mesh setup
could get their FRR configuration overwritten when using unrelated SDN
features. Since this endpoint is called *after* committing the new SDN
configuration, but handles writing the FRR configuration, we need a
way to signal this endpoint to skip writing the FRR configuration from
the `PUT /cluster/sdn` endpoint, where we can check for this case.

[1] 
https://pve.proxmox.com/mediawiki/index.php?title=Full_Mesh_Network_for_Ceph_Server&oldid=12146

Co-authored-by: Stefan Hanreich <s.hanre...@proxmox.com>
Signed-off-by: Gabriel Goller <g.gol...@proxmox.com>
---
 PVE/API2/Network.pm | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
index 12ee6cca0..2ff729f7a 100644
--- a/PVE/API2/Network.pm
+++ b/PVE/API2/Network.pm
@@ -777,6 +777,11 @@ __PACKAGE__->register_method({
        additionalProperties => 0,
        properties => {
            node => get_standard_option('pve-node'),
+           skip_frr => {
+               type => 'boolean',
+               description => 'Whether FRR config generation should get 
skipped or not.',
+               optional => 1,
+           },
        },
     },
     returns => { type => 'string' },
@@ -791,6 +796,8 @@ __PACKAGE__->register_method({
        my $current_config_file = "/etc/network/interfaces";
        my $new_config_file = "/etc/network/interfaces.new";
 
+       my $skip_frr = extract_param($param, 'skip_frr');
+
        assert_ifupdown2_installed();
 
        my $worker = sub {
@@ -798,7 +805,7 @@ __PACKAGE__->register_method({
            rename($new_config_file, $current_config_file) if -e 
$new_config_file;
 
            if ($have_sdn) {
-               PVE::Network::SDN::generate_zone_config();
+               PVE::Network::SDN::generate_etc_network_config();
                PVE::Network::SDN::generate_dhcp_config();
            }
 
@@ -810,8 +817,8 @@ __PACKAGE__->register_method({
            };
            PVE::Tools::run_command(['ifreload', '-a'], errfunc => $err);
 
-           if ($have_sdn) {
-               PVE::Network::SDN::generate_controller_config(1);
+           if ($have_sdn && !$skip_frr) {
+               PVE::Network::SDN::generate_frr_config(1);
            }
        };
        return $rpcenv->fork_worker('srvreload', 'networking', $authuser, 
$worker);
@@ -868,3 +875,5 @@ __PACKAGE__->register_method({
 
        return undef;
     }});
+
+1;
-- 
2.39.5


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

Reply via email to