From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id E48B01FF15C for ; Fri, 11 Jul 2025 11:52:13 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 37083CFAD; Fri, 11 Jul 2025 11:52:58 +0200 (CEST) From: Hannes Duerr To: pve-devel@lists.proxmox.com Date: Fri, 11 Jul 2025 11:52:05 +0200 Message-ID: <20250711095206.30852-1-h.duerr@proxmox.com> X-Mailer: git-send-email 2.47.2 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.079 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH pve-network 1/2] dhcp: make plugin types query from Dhcp.pm possible X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" At the moment it is possible to query the Dhcp plugin types from the `use PVE::Network::SDN::Dhcp::Plugin` without importing `PVE::Network::SDN::Dhcp`. In consequence the section config is not created although one would have been expected it to be created. Importing `use pve::network::sdn::Dhcp` would solve the issue, but since this is not a nice pattern and in order to avoid such problems in the future, we are now making it possible to query the plugin type from DHCP. If you then import DHCP, the section config will be built correctly. The problem was noticed/introduced after the ordering of the two imports `use PVE::Network::SDN::Vnets` and `use PVE::Network::SDN::Vnets` were swapped in pve-bridge [0], resulting in the error: file /etc/pve/sdn/zones.cfg line 2 (section 'simple') - unable to parse value of 'dhcp': value 'dnsmasq' does not have a value in the enumeration '' The Zones Section Config no longer returned correct values for dhcp because the Section Config was not yet built correctly at that time. Swapping the entries back also solves the issue, because Vnets.pm is importing `PVE::Network::SDN::Dhcp`, but that is also not really a nice solution [0] https://lore.proxmox.com/pve-devel/20250625155751.268047-6-f.ebner@proxmox.com/ Signed-off-by: Hannes Duerr --- src/PVE/Network/SDN/Dhcp.pm | 4 ++++ src/PVE/Network/SDN/Zones/SimplePlugin.pm | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/PVE/Network/SDN/Dhcp.pm b/src/PVE/Network/SDN/Dhcp.pm index 5f0d46d..7dc38fb 100644 --- a/src/PVE/Network/SDN/Dhcp.pm +++ b/src/PVE/Network/SDN/Dhcp.pm @@ -19,6 +19,10 @@ PVE::Network::SDN::Dhcp::Plugin->init(); PVE::Network::SDN::Dhcp::Dnsmasq->register(); PVE::Network::SDN::Dhcp::Dnsmasq->init(); +sub plugin_types { + return PVE::Network::SDN::Dhcp::Plugin->lookup_types(); +} + sub add_mapping { my ($vnetid, $mac, $ip4, $ip6) = @_; diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm b/src/PVE/Network/SDN/Zones/SimplePlugin.pm index 97cf29e..f5cd18e 100644 --- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm +++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm @@ -3,7 +3,7 @@ package PVE::Network::SDN::Zones::SimplePlugin; use strict; use warnings; use PVE::Network::SDN::Zones::Plugin; -use PVE::Network::SDN::Dhcp::Plugin; +use PVE::Network::SDN::Dhcp; use PVE::Exception qw(raise raise_param_exc); use PVE::Cluster; use PVE::Tools; @@ -32,7 +32,7 @@ sub properties { dhcp => { description => 'Type of the DHCP backend for this zone', type => 'string', - enum => PVE::Network::SDN::Dhcp::Plugin->lookup_types(), + enum => PVE::Network::SDN::Dhcp->plugin_types(), }, }; } -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel