From ce5782df8fa0fada0396ec69f5fe05745cb942be Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Wed, 2 Sep 2015 16:21:11 -0500 Subject: [PATCH] Tear down network devices during container halt On very busy systems, some virtual network devices won't be destroyed after a container halts. This patch uses the lxc_delete_network() method to ensure that network devices attached to the container are destroyed when the container halts. Without the patch, some virtual network devices are left over on the system and must be removed with `ip link del `. This caused containers with lxc.network.veth.pair to not be able to start. For containers using randomly generated virtual network device names, the old devices will hang around on the bridge with their original MAC address. Signed-off-by: Major Hayden --- src/lxc/start.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lxc/start.c b/src/lxc/start.c index b85da2df1..ffb8d126b 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -1222,7 +1222,12 @@ int __lxc_start(const char *name, struct lxc_conf *conf, } } + DEBUG("Pushing physical nics back to host namespace"); lxc_rename_phys_nics_on_shutdown(netnsfd, handler->conf); + + DEBUG("Tearing down virtual network devices used by container"); + lxc_delete_network(handler); + if (netnsfd >= 0) close(netnsfd); -- 2.47.2