public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Thomas Lamprecht <t.lamprecht@proxmox.com>
Subject: [PATCH network v2] sdn: fabrics: only warn about a host vrf on a fabric interface
Date: Fri, 20 Nov 2026 19:50:36 +0100	[thread overview]
Message-ID: <20261120185037.493949-1-g.goller@proxmox.com> (raw)

A vrf set on a fabric interface made the whole SDN network config of
the node fail, so zones and other fabrics were not updated either.
Print a warning instead.

This does not change either vrf setting. If the host stanza precedes the
SDN include and assigns a different vrf, the host assignment takes
precedence and the interface stays outside the intended fabric vrf.

The warning is not shown in the dry-run preview, like other warnings
emitted during config generation.

Fixes: 44fe83e54c04 ("sdn: allow fabrics to use simple zone VRFs")
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---

Changes in v2:
  - Reword the warning to identify the host VRF and suggest removing the host
    VRF setting.
  - Test that conflicting host VRFs warn without blocking config generation
    for standalone and zone fabrics, and that unrelated interfaces don't warn.
  - Clarify when the host VRF takes precedence and note that the warning
    isn't shown in the dry-run preview.
  - Add a Fixes: tag for the change that introduced the error.
  - Link to v1: https://lore.proxmox.com/pve-devel/20261120142518.201252-1-g.goller@proxmox.com/

 src/PVE/Network/SDN/Fabrics.pm       |  5 +++--
 src/test/run_test_fabric_host_vrf.pl | 33 ++++++++++++++++++----------
 2 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/src/PVE/Network/SDN/Fabrics.pm b/src/PVE/Network/SDN/Fabrics.pm
index c3a3a8111537..9cda85096771 100644
--- a/src/PVE/Network/SDN/Fabrics.pm
+++ b/src/PVE/Network/SDN/Fabrics.pm
@@ -10,6 +10,7 @@ use PVE::Exception qw(raise_param_exc);
 use PVE::JSONSchema qw(get_standard_option);
 use PVE::INotify;
 use PVE::ParseUtils qw($IPV4RE);
+use PVE::RESTEnvironment qw(log_warn);
 
 use PVE::Network::SDN::Formats;
 use PVE::Network::SDN::PrefixLists;
@@ -292,8 +293,8 @@ sub generate_etc_network_config {
     my $ifaces = PVE::INotify::read_file('interfaces')->{ifaces};
     for my $iface (sort keys %$ifaces) {
         next if !$ifaces->{$iface}->{vrf};
-        die "interface '$iface' - cannot set VRF '$ifaces->{$iface}->{vrf}' on an interface that"
-            . " is part of a fabric, remove the VRF from the host interface\n"
+        log_warn("interface '$iface' has host VRF '$ifaces->{$iface}->{vrf}', remove the host"
+                . " VRF setting so the fabric can manage this interface")
             if $fabric_object->is_fabric_interface($nodename, $iface);
     }
 
diff --git a/src/test/run_test_fabric_host_vrf.pl b/src/test/run_test_fabric_host_vrf.pl
index 9ed3f2579d34..cde22263996b 100755
--- a/src/test/run_test_fabric_host_vrf.pl
+++ b/src/test/run_test_fabric_host_vrf.pl
@@ -40,17 +40,26 @@ $inotify->mock(
     },
 );
 
+my @warnings;
+my $fabrics = Test::MockModule->new('PVE::Network::SDN::Fabrics');
+$fabrics->mock(log_warn => sub { push @warnings, $_[0] });
+
 $interfaces = { ens19 => { vrf => 'vrf_blue' } };
-eval { PVE::Network::SDN::Fabrics::generate_etc_network_config($running_cfg) };
+my $config = eval { PVE::Network::SDN::Fabrics::generate_etc_network_config($running_cfg) };
+is($@, '', 'VRF on a fabric interface does not fail');
+is(scalar(@warnings), 1, 'VRF on a fabric interface warns once');
 like(
-    $@,
-    qr/^interface 'ens19' - cannot set VRF 'vrf_blue' on an interface that is part of a fabric/,
-    'VRF on a fabric interface fails',
+    $warnings[0],
+    qr/^interface 'ens19' has host VRF 'vrf_blue'/,
+    'warning names the interface and VRF',
 );
+like($config, qr/^iface ens19 inet static$/m, 'fabric interface config is still generated');
 
+@warnings = ();
 $interfaces = { ens20 => { vrf => 'vrf_blue' }, ens19 => {} };
-my $config = eval { PVE::Network::SDN::Fabrics::generate_etc_network_config($running_cfg) };
+$config = eval { PVE::Network::SDN::Fabrics::generate_etc_network_config($running_cfg) };
 is($@, '', 'VRF on another interface is allowed');
+is(scalar(@warnings), 0, 'VRF on another interface does not warn');
 like($config, qr/^iface ens19 inet static$/m, 'fabric interface config is generated');
 
 my $zone_cfg = {
@@ -73,6 +82,7 @@ my $zone_cfg = {
     },
 };
 
+@warnings = ();
 $interfaces = { ens19 => {} };
 $config = eval { PVE::Network::SDN::Fabrics::generate_etc_network_config($zone_cfg) };
 is($@, '', 'OSPF fabric in a zone VRF is allowed');
@@ -82,12 +92,13 @@ like(
     'fabric interface is put into the zone VRF',
 );
 
+is(scalar(@warnings), 0, 'zone fabric without host VRF does not warn');
+
 $interfaces = { ens19 => { vrf => 'vrf_red' } };
-eval { PVE::Network::SDN::Fabrics::generate_etc_network_config($zone_cfg) };
-like(
-    $@,
-    qr/^interface 'ens19' - cannot set VRF 'vrf_red'/,
-    'host VRF on a zone fabric interface fails',
-);
+$config = eval { PVE::Network::SDN::Fabrics::generate_etc_network_config($zone_cfg) };
+is($@, '', 'host VRF on a zone fabric interface does not fail');
+is(scalar(@warnings), 1, 'host VRF on a zone fabric interface warns once');
+like($warnings[0], qr/^interface 'ens19' has host VRF 'vrf_red'/, 'zone warning names the VRF');
+like($config, qr/^iface ens19 inet static$/m, 'zone fabric interface config is still generated');
 
 done_testing();
-- 
2.47.3





                 reply	other threads:[~2026-11-20 18:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261120185037.493949-1-g.goller@proxmox.com \
    --to=g.goller@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal