Personnaly, I really think that we shouldn't generate the whole dhcp config (reading the full ipam db), each time we allocate a single ip.
With external ipam, that mean 1api call for each subnet, it can be really slow. (for example, I have 400 subnets in productions) and this is only done on local node, so we'll to regenerated in other node if we migrate vm, restore backup, HA moving vm,.... I think that mac-ip should be added at vm start, it's really more simple and light. -------- Message initial -------- De: Stefan Lendl <s.le...@proxmox.com> Répondre à: Proxmox VE development discussion <pve- de...@lists.proxmox.com> À: pve-devel@lists.proxmox.com Objet: [pve-devel] [RFC pve-network 2/6] always generate dnsmasq ethers file Date: 27/10/2023 13:29:56 Makes dnsmasq stateless and can be generated from the IPAM. On dhcp_add_ip always generate the entire ethers file. Signed-off-by: Stefan Lendl <s.le...@proxmox.com> --- src/PVE/Network/SDN/Dhcp.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/PVE/Network/SDN/Dhcp.pm b/src/PVE/Network/SDN/Dhcp.pm index b92c73a..b854cce 100644 --- a/src/PVE/Network/SDN/Dhcp.pm +++ b/src/PVE/Network/SDN/Dhcp.pm @@ -87,8 +87,14 @@ sub add_mapping { next if !$ip; + # generates ethers file every time + my $ipam_db = $ipam_plugin->read_db(); + my $dbzone = $ipam_db->{zones}->{$subnet_config->{zone}}; + my $dbsubnet = $dbzone->{subnets}->{$subnet_config- >{cidr}}; + my $dbsubnet_ips = $dbsubnet->{ips}; + my $dhcp_plugin = PVE::Network::SDN::Dhcp::Plugin- >lookup($dhcp_config->{type}); - $dhcp_plugin->add_ip_mapping($dhcp_config, $mac, $ip); + $dhcp_plugin->generate_config($dhcp_config, $dbsubnet_ips); return $ip; } _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel