From: Alexandre Derumier <aderum...@odiso.com> Signed-off-by: Alexandre Derumier <aderum...@odiso.com> --- src/lxc-pve-prestart-hook | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/src/lxc-pve-prestart-hook b/src/lxc-pve-prestart-hook index 936d0bf..fc577e4 100755 --- a/src/lxc-pve-prestart-hook +++ b/src/lxc-pve-prestart-hook @@ -21,6 +21,12 @@ use PVE::Storage; use PVE::Syscall qw(:fsmount); use PVE::Tools qw(AT_FDCWD O_PATH); +my $have_sdn; +eval { + require PVE::Network::SDN::Vnets; + $have_sdn = 1; +}; + my $WARNFD; sub log_warn { my ($vmid, $message) = @_; @@ -140,6 +146,15 @@ PVE::LXC::Tools::lxc_hook('pre-start', 'lxc', sub { } PVE::Tools::file_set_contents($devlist_file, $devlist); } + + if ($have_sdn) { + for my $k (keys %$conf) { + 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}); + } + } }); # Leftover cgroups prevent lxc from starting without any useful information -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel