my $rootfs = $ENV{LXC_ROOTFS_PATH};
die "Missing container root directory!\n" if !$rootfs;
PVE::Tools::run_command(['umount', '--recursive', $rootfs]);
-
+
+ # Because netlink is not a reliable protocol it can happen that lxc's
+ # link-deletion messages get lost (or end up being too early?)
+ for my $k (keys %$conf) {
+ next if $k !~ /^net(\d+)/;
+ my $ind = $1;
+ my $net = PVE::LXC::Config->parse_lxc_network($conf->{$k});
+ next if $net->{type} ne 'veth';
+ my $name = "veth${vmid}i${ind}";
+ # veth_delete tests with '-d /sys/class/net/$name' before running the command
+ PVE::Network::veth_delete("veth${vmid}i$ind");
+ }
+
return undef;
}});