public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-network 1/2] dhcp: make plugin types query from Dhcp.pm possible
@ 2025-07-11  9:52 Hannes Duerr
  2025-07-11  9:52 ` [pve-devel] [PATCH pve-network 2/2] dhcp: remove unused SubnetPlugin import Hannes Duerr
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hannes Duerr @ 2025-07-11  9:52 UTC (permalink / raw)
  To: 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 <h.duerr@proxmox.com>
---
 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH pve-network 2/2] dhcp: remove unused SubnetPlugin import
  2025-07-11  9:52 [pve-devel] [PATCH pve-network 1/2] dhcp: make plugin types query from Dhcp.pm possible Hannes Duerr
@ 2025-07-11  9:52 ` Hannes Duerr
  2025-07-16  7:43 ` [pve-devel] [PATCH pve-network 1/2] dhcp: make plugin types query from Dhcp.pm possible Friedrich Weber
  2025-07-16 22:40 ` [pve-devel] applied: " Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Hannes Duerr @ 2025-07-11  9:52 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
---
 src/PVE/Network/SDN/Dhcp.pm | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/PVE/Network/SDN/Dhcp.pm b/src/PVE/Network/SDN/Dhcp.pm
index 7dc38fb..65e40d4 100644
--- a/src/PVE/Network/SDN/Dhcp.pm
+++ b/src/PVE/Network/SDN/Dhcp.pm
@@ -6,7 +6,6 @@ use warnings;
 use PVE::Cluster;
 
 use PVE::Network::SDN;
-use PVE::Network::SDN::SubnetPlugin;
 use PVE::Network::SDN::Ipams;
 use PVE::Network::SDN::Subnets;
 use PVE::Network::SDN::Dhcp::Plugin;
-- 
2.47.2



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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH pve-network 1/2] dhcp: make plugin types query from Dhcp.pm possible
  2025-07-11  9:52 [pve-devel] [PATCH pve-network 1/2] dhcp: make plugin types query from Dhcp.pm possible Hannes Duerr
  2025-07-11  9:52 ` [pve-devel] [PATCH pve-network 2/2] dhcp: remove unused SubnetPlugin import Hannes Duerr
@ 2025-07-16  7:43 ` Friedrich Weber
  2025-07-16 22:40 ` [pve-devel] applied: " Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Friedrich Weber @ 2025-07-16  7:43 UTC (permalink / raw)
  To: Proxmox VE development discussion, Hannes Duerr

On 11/07/2025 11:52, Hannes Duerr wrote:
> 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 <h.duerr@proxmox.com>
> ---

Tested that

- currently, on trixie, a VM in a Simple zone with automatic DHCP
doesn't get a DHCP lease, and the 'dnsmasq does not have a value in the
enumeration' warning appears in the qmstart task log (but is not marked
as a task log warning)

- after applying these two patches, the VM gets a DHCP lease again

Though I haven't really tested much other SDN functionality, consider this

Tested-by: Friedrich Weber <f.weber@proxmox.com>



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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied: [PATCH pve-network 1/2] dhcp: make plugin types query from Dhcp.pm possible
  2025-07-11  9:52 [pve-devel] [PATCH pve-network 1/2] dhcp: make plugin types query from Dhcp.pm possible Hannes Duerr
  2025-07-11  9:52 ` [pve-devel] [PATCH pve-network 2/2] dhcp: remove unused SubnetPlugin import Hannes Duerr
  2025-07-16  7:43 ` [pve-devel] [PATCH pve-network 1/2] dhcp: make plugin types query from Dhcp.pm possible Friedrich Weber
@ 2025-07-16 22:40 ` Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2025-07-16 22:40 UTC (permalink / raw)
  To: pve-devel, Hannes Duerr

On Fri, 11 Jul 2025 11:52:05 +0200, Hannes Duerr wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/2] dhcp: make plugin types query from Dhcp.pm possible
      commit: e78d25b
[2/2] dhcp: remove unused SubnetPlugin import
      commit: 0d455b9


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-16 22:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-11  9:52 [pve-devel] [PATCH pve-network 1/2] dhcp: make plugin types query from Dhcp.pm possible Hannes Duerr
2025-07-11  9:52 ` [pve-devel] [PATCH pve-network 2/2] dhcp: remove unused SubnetPlugin import Hannes Duerr
2025-07-16  7:43 ` [pve-devel] [PATCH pve-network 1/2] dhcp: make plugin types query from Dhcp.pm possible Friedrich Weber
2025-07-16 22:40 ` [pve-devel] applied: " Thomas Lamprecht

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