From 0b034c15f49f40b7644aaceccdbc7792b205a789 Mon Sep 17 00:00:00 2001 From: Stefan Lendl Date: Tue, 21 Nov 2023 15:55:56 +0100 Subject: [PATCH] sdn: pass vmid and hostname to add_dhcp_mapping if no DHCP mapping was found in IPAM it will request a new IP which requires these values. Signed-off-by: Stefan Lendl --- PVE/QemuServer.pm | 2 +- vm-network-scripts/pve-bridge | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 3028e709..978aac70 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -5381,7 +5381,7 @@ sub vmconfig_update_net { if ($hotplug) { if ($have_sdn) { PVE::Network::SDN::Vnets::add_next_free_cidr($newnet->{bridge}, $conf->{name}, $newnet->{macaddr}, $vmid, undef, 1); - PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{macaddr}); + PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{macaddr}, $vmid, $conf->{name}); } vm_deviceplug($storecfg, $conf, $vmid, $opt, $newnet, $arch, $machine_type); } else { diff --git a/vm-network-scripts/pve-bridge b/vm-network-scripts/pve-bridge index e8f8798a..85997a03 100755 --- a/vm-network-scripts/pve-bridge +++ b/vm-network-scripts/pve-bridge @@ -37,7 +37,7 @@ my $conf = PVE::QemuConfig->load_config($vmid, $migratedfrom); my $netconf = $conf->{$netid}; $netconf = $conf->{pending}->{$netid} if !$migratedfrom && defined($conf->{pending}->{$netid}); - + die "unable to get network config '$netid'\n" if !defined($netconf); @@ -45,7 +45,7 @@ my $net = PVE::QemuServer::parse_net($netconf); die "unable to parse network config '$netid'\n" if !$net; if ($have_sdn) { - PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, $net->{macaddr}); + PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, $net->{macaddr}, $vmid, $conf->{name}); 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}); } else { -- 2.39.5