[pve-devel] [RFC qemu-server 3/5] vm_start : vm-network-scripts: get ip from ipam and add dhcp reservation

Alexandre Derumier aderumier at odiso.com
Mon Nov 13 11:04:10 CET 2023


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 vm-network-scripts/pve-bridge | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vm-network-scripts/pve-bridge b/vm-network-scripts/pve-bridge
index c6b3ea8..24efaad 100755
--- a/vm-network-scripts/pve-bridge
+++ b/vm-network-scripts/pve-bridge
@@ -10,6 +10,7 @@ use PVE::Network;
 my $have_sdn;
 eval {
     require PVE::Network::SDN::Zones;
+    require PVE::Network::SDN::Vnets;
     require PVE::Network::SDN::Dhcp;
     $have_sdn = 1;
 };
@@ -45,7 +46,8 @@ my $net = PVE::QemuServer::parse_net($netconf);
 die "unable to parse network config '$netid'\n" if !$net;
 
 if ($have_sdn) {
-    PVE::Network::SDN::Dhcp::add_mapping($net->{bridge}, $net->{macaddr});
+    my ($ip4, $ip6) = PVE::Network::SDN::Vnets::get_ips_from_mac($net->{bridge}, $net->{macaddr});
+    PVE::Network::SDN::Dhcp::add_mapping($net->{bridge}, $net->{macaddr}, $ip4, $ip6);
 
     PVE::Network::SDN::Zones::tap_create($iface, $net->{bridge});
     PVE::Network::SDN::Zones::tap_plug($iface, $net->{bridge}, $net->{tag}, $net->{firewall}, $net->{trunks}, $net->{rate});
-- 
2.39.2





More information about the pve-devel mailing list