]> git.proxmox.com Git - pve-container.git/commitdiff
sdn: pass vmid and hostname to add_dhcp_mapping
authorStefan Lendl <s.lendl@proxmox.com>
Tue, 21 Nov 2023 14:55:55 +0000 (15:55 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 21 Nov 2023 19:56:09 +0000 (20:56 +0100)
If no DHCP mapping was found in IPAM it will request a new IP.
In order to register an IPAM mapping it requires these values.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
src/PVE/LXC.pm
src/lxc-pve-prestart-hook

index 936182371284f26fddbdef684b82a0df5bf5dbef..7883cfb990a2d940f0796e89a83aa48cadd8501d 100644 (file)
@@ -993,7 +993,7 @@ sub update_net {
                warn $@ if $@;
 
                PVE::Network::SDN::Vnets::add_next_free_cidr($newnet->{bridge}, $conf->{hostname}, $newnet->{hwaddr}, $vmid, undef, 1);
-               PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{hwaddr});
+               PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{hwaddr}, $vmid, $conf->{hostname});
            }
 
            delete $conf->{$opt};
@@ -1046,7 +1046,7 @@ sub update_net {
     } else {
        if ($have_sdn) {
            PVE::Network::SDN::Vnets::add_next_free_cidr($newnet->{bridge}, $conf->{hostname}, $newnet->{hwaddr}, $vmid, undef, 1);
-           PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{hwaddr});
+           PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{hwaddr}, $vmid, $conf->{hostname});
        }
 
        hotplug_net($vmid, $conf, $opt, $newnet, $netid);
index ab357743c86e08e60f933af3d2039b7fe551d8d7..4f5c7e22e3be09e0214eb2c47267420b4c1b5b29 100755 (executable)
@@ -210,7 +210,7 @@ PVE::LXC::Tools::lxc_hook('pre-start', 'lxc', sub {
            next if $k !~ /^net(\d+)/;
            my $net = PVE::LXC::Config->parse_lxc_network($conf->{$k});
            next if $net->{type} ne 'veth';
-           PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, $net->{hwaddr});
+           PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, $net->{hwaddr}, $conf->{vmid}, $conf->{hostname});
        }
     }
 });