]> git.proxmox.com Git - mirror_lxc.git/commit
conf, start: be smarter when deleting networks
authorChristian Brauner <christian.brauner@canonical.com>
Fri, 28 Oct 2016 11:40:44 +0000 (13:40 +0200)
committerChristian Brauner <christian.brauner@canonical.com>
Sat, 19 Nov 2016 04:11:34 +0000 (05:11 +0100)
commit358daf49c0627d382a21fc03464464520218c8fa
treeff27eee489c6af22da79a4188726a558264f54bd
parente97946ae96bccbc3bc36db5a3d4b952d14541171
conf, start: be smarter when deleting networks

- So far we blindly called lxc_delete_network() to make sure that we deleted
  all network interfaces. This resulted in pointless netlink calls, especially
  when a container had multiple networks defined. Let's be smarter and have
  lxc_delete_network() return a boolean that indicates whether *all* configured
  networks have been deleted. If so, don't needlessly try to delete them again
  in start.c. This also decreases confusing error messages a user might see.

- When we receive -ENODEV from one of our lxc_netdev_delete_*() functions,
  let's assume that either the network device already got deleted or that it
  got moved to a different network namespace. Inform the user about this but do
  not report an error in this case.

- When we have explicitly deleted the host side of a veth pair let's
  immediately free(priv.veth_attr.pair) and NULL it, or
  memset(priv.veth_attr.pair, ...) the corresponding member so we don't
  needlessly try to destroy them again when we have to call
  lxc_delete_network() again in start.c

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
src/lxc/conf.c
src/lxc/conf.h
src/lxc/start.c