This makes sure to delete veth devices after we've killed the container.
In the case of a destroy or crash, this ensures the system is cleaned
up properly.
To be applied atop Daniel Berrange's current LXC patch stack.
diff -r b18ae864eb98 -r cd0bd9a6288a src/lxc_driver.c
--- a/src/lxc_driver.c Wed Aug 13 09:40:08 2008 -0700
+++ b/src/lxc_driver.c Thu Aug 14 08:50:49 2008 -0700
@@ -375,6 +375,7 @@
int rc = -1;
int waitRc;
int childStatus = -1;
+ virDomainNetDefPtr net;
while (((waitRc = waitpid(vm->pid, &childStatus, 0)) == -1) &&
errno == EINTR)
@@ -403,6 +404,11 @@
vm->pid = -1;
vm->def->id = -1;
vm->monitor = -1;
+
+ for (net = vm->def->nets; net; net = net->next) {
+ vethInterfaceUpOrDown(net->ifname, 0);
+ vethDelete(net->ifname);
+ }
return rc;
}