all lists on 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] sdn: zones: warn about host interfaces in a missing zone VRF
Date: Fri, 20 Nov 2026 15:11:56 +0100	[thread overview]
Message-ID: <20261120141157.192734-1-g.goller@proxmox.com> (raw)

Disabling dedicated-vrf, removing the node from a zone or deleting the
zone removes its VRF, but host interfaces may still be in it. ifreload
then cannot enslave them or add their gateway, which is easy to miss
in the apply log.

Warn when generating the SDN network config of the node, as only the
node sees its own interfaces file.

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/Network/SDN/Zones.pm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
index 1c90ea769a41..458ae8cc1b40 100644
--- a/src/PVE/Network/SDN/Zones.pm
+++ b/src/PVE/Network/SDN/Zones.pm
@@ -11,6 +11,7 @@ use PVE::Tools qw(extract_param dir_glob_regex run_command);
 use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file);
 use PVE::IPRoute2;
 use PVE::Network;
+use PVE::RESTEnvironment qw(log_warn);
 
 use PVE::Network::SDN::Controllers;
 use PVE::Network::SDN::Dns;
@@ -228,6 +229,21 @@ sub generate_etc_network_config {
         }
     }
 
+    # Disabling the dedicated VRF of a zone, removing the node from the zone or deleting the zone
+    # removes its VRF, but host interfaces may still reference it. ifreload then cannot enslave
+    # them. The zone API cannot check this, as the host network config is local to each node.
+    #
+    # Only zone VRFs (vrf_<zone>) are checked. Other VRFs can be defined in files sourced by
+    # /etc/network/interfaces, which are not parsed here.
+    my $host_ifaces = $interfaces_config->{ifaces};
+    for my $iface (sort keys $host_ifaces->%*) {
+        my $vrf = $host_ifaces->{$iface}->{vrf};
+        next if !$vrf || $vrf !~ m/^vrf_/;
+        next if $config->{$vrf} || $host_ifaces->{$vrf};
+
+        log_warn("host interface '$iface' is in VRF '$vrf', which does not exist on this node");
+    }
+
     my $raw_network_config = "\#version:$version\n";
     foreach my $iface (sort keys %$config) {
         $raw_network_config .= "\n";
-- 
2.47.3





             reply	other threads:[~2026-11-20 14:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 14:11 Gabriel Goller [this message]
2026-11-20 18:32 ` [PATCH network] sdn: zones: warn about host interfaces in a missing zone VRF 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=20261120141157.192734-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 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