all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Alexandre Derumier <aderumier@odiso.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-network 1/2] sdn: config generation : check if interfaces.d/sdn is sourced
Date: Fri, 23 Jun 2023 14:49:40 +0200	[thread overview]
Message-ID: <20230623124941.895654-2-aderumier@odiso.com> (raw)
In-Reply-To: <20230623124941.895654-1-aderumier@odiso.com>

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 src/PVE/Network/SDN.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
index 1ad85e5..7ff550b 100644
--- a/src/PVE/Network/SDN.pm
+++ b/src/PVE/Network/SDN.pm
@@ -13,7 +13,7 @@ use PVE::Network::SDN::Subnets;
 
 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::RESTEnvironment qw(log_warn);
 
 my $running_cfg = "sdn/.running-config";
 
@@ -208,6 +208,15 @@ sub get_local_vnets {
 
 sub generate_zone_config {
     my $raw_config = PVE::Network::SDN::Zones::generate_etc_network_config();
+    if ($raw_config) {
+	eval {
+	    my $net_cfg = PVE::INotify::read_file('interfaces', 1);
+	    my $opts = $net_cfg->{data}->{options};
+	    warn "missing 'source /etc/network/interfaces.d/sdn' directive for SDN support!\n"
+		if ! grep { $_->[1] =~ m!^source /etc/network/interfaces.d/(:?sdn|\*)! } @$opts;
+	};
+	log_warn("Failed to read network interfaces definition - $@") if $@;
+    }
     PVE::Network::SDN::Zones::write_etc_network_config($raw_config);
 }
 
-- 
2.39.2




  reply	other threads:[~2023-06-23 12:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23 12:49 [pve-devel] [PATCH pve-network 0/2] add warning if sdn config in not include in /etc/network/interfaces Alexandre Derumier
2023-06-23 12:49 ` Alexandre Derumier [this message]
2023-06-23 12:49 ` [pve-devel] [PATCH pve-network 2/2] zones: status: display specific message if vnet is not generated Alexandre Derumier
2023-07-19  9:52 ` [pve-devel] applied-series: [PATCH pve-network 0/2] add warning if sdn config in not include in /etc/network/interfaces Fabian Grünbichler

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=20230623124941.895654-2-aderumier@odiso.com \
    --to=aderumier@odiso.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