[lxc-devel] [lxc/lxc] a68725: utils: add lxc_preserve_ns()

GitHub noreply at github.com
Sat Nov 19 18:17:13 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: a687256f1dbde991b7afaf8b8f63570ed4671781
      https://github.com/lxc/lxc/commit/a687256f1dbde991b7afaf8b8f63570ed4671781
  Author: Christian Brauner <christian.brauner at canonical.com>
  Date:   2016-11-19 (Sat, 19 Nov 2016)

  Changed paths:
    M src/lxc/utils.c
    M src/lxc/utils.h

  Log Message:
  -----------
  utils: add lxc_preserve_ns()

This allows to retrieve a file descriptor referring to a namespace.

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>


  Commit: 738d0deb13040ad6026fd345063c43bd4291babd
      https://github.com/lxc/lxc/commit/738d0deb13040ad6026fd345063c43bd4291babd
  Author: Christian Brauner <christian.brauner at canonical.com>
  Date:   2016-11-19 (Sat, 19 Nov 2016)

  Changed paths:
    M src/lxc/conf.c
    M src/lxc/start.c
    M src/lxc/start.h

  Log Message:
  -----------
  start: add netnsfd to lxc_handler

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>


  Commit: 64d2fcb5cfe9c82b71461efce42e5ae609730d71
      https://github.com/lxc/lxc/commit/64d2fcb5cfe9c82b71461efce42e5ae609730d71
  Author: Christian Brauner <christian.brauner at canonical.com>
  Date:   2016-11-19 (Sat, 19 Nov 2016)

  Changed paths:
    M src/lxc/conf.c

  Log Message:
  -----------
  conf: use lxc_preserve_ns()

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>


  Commit: 383613cc36b285253fff6adbca2a79516c3e19e0
      https://github.com/lxc/lxc/commit/383613cc36b285253fff6adbca2a79516c3e19e0
  Author: Christian Brauner <christian.brauner at canonical.com>
  Date:   2016-11-19 (Sat, 19 Nov 2016)

  Changed paths:
    M src/lxc/attach.c

  Log Message:
  -----------
  attach: use lxc_preserve_ns()

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>


  Commit: 5d04811edfe9b9ef9aac6fb645560202575b96b8
      https://github.com/lxc/lxc/commit/5d04811edfe9b9ef9aac6fb645560202575b96b8
  Author: Christian Brauner <christian.brauner at canonical.com>
  Date:   2016-11-19 (Sat, 19 Nov 2016)

  Changed paths:
    M src/lxc/lxc_user_nic.c

  Log Message:
  -----------
  lxc_user_nic: use lxc_preserve_ns()

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>


  Commit: 198cbbaa1d1283cdac929c164f7b9d82503a647b
      https://github.com/lxc/lxc/commit/198cbbaa1d1283cdac929c164f7b9d82503a647b
  Author: Christian Brauner <christian.brauner at canonical.com>
  Date:   2016-11-19 (Sat, 19 Nov 2016)

  Changed paths:
    M src/lxc/conf.c
    M src/lxc/start.c

  Log Message:
  -----------
  conf, start: improve log output

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>


  Commit: e97946ae96bccbc3bc36db5a3d4b952d14541171
      https://github.com/lxc/lxc/commit/e97946ae96bccbc3bc36db5a3d4b952d14541171
  Author: Christian Brauner <christian.brauner at canonical.com>
  Date:   2016-11-19 (Sat, 19 Nov 2016)

  Changed paths:
    M src/lxc/conf.c

  Log Message:
  -----------
  conf: explicitly remove veth device from host

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>


  Commit: 358daf49c0627d382a21fc03464464520218c8fa
      https://github.com/lxc/lxc/commit/358daf49c0627d382a21fc03464464520218c8fa
  Author: Christian Brauner <christian.brauner at canonical.com>
  Date:   2016-11-19 (Sat, 19 Nov 2016)

  Changed paths:
    M src/lxc/conf.c
    M src/lxc/conf.h
    M src/lxc/start.c

  Log Message:
  -----------
  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 at canonical.com>


  Commit: 4d8ac866fc29a555531029fec797ce7125dd0701
      https://github.com/lxc/lxc/commit/4d8ac866fc29a555531029fec797ce7125dd0701
  Author: Christian Brauner <christian.brauner at canonical.com>
  Date:   2016-11-19 (Sat, 19 Nov 2016)

  Changed paths:
    M src/lxc/start.c
    M src/lxc/utils.c

  Log Message:
  -----------
  start, utils: improve preserve_ns()

- Allocating an error message that the caller must free seems pointless. We can
  just print the error message in preserve_ns() itself. This also allows us to
  avoid using the GNU extension asprintf().
- Improve lxc_preserve_ns(): By passing in NULL or "" as the second argument
  the function can now also be used to check whether namespaces are supported
  by the kernel.
- Use lxc_preserve_ns() in preserve_ns().

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>


  Commit: 408da065fb80f7932274225d6130f5c76ea16a07
      https://github.com/lxc/lxc/commit/408da065fb80f7932274225d6130f5c76ea16a07
  Author: Christian Brauner <christian.brauner at canonical.com>
  Date:   2016-11-19 (Sat, 19 Nov 2016)

  Changed paths:
    M src/lxc/error.c
    M src/lxc/start.c

  Log Message:
  -----------
  start, error: improve log + non-functional changes

Improve log and comments in a bunch of places to make it easier for us on bug
reports.

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>


  Commit: 9662e444d9968b1329b2519d6c1b2855c882c5ba
      https://github.com/lxc/lxc/commit/9662e444d9968b1329b2519d6c1b2855c882c5ba
  Author: Christian Brauner <christian.brauner at canonical.com>
  Date:   2016-11-19 (Sat, 19 Nov 2016)

  Changed paths:
    M src/lxc/namespace.c
    M src/lxc/namespace.h
    M src/lxc/start.c
    M src/lxc/start.h

  Log Message:
  -----------
  start, namespace: move ns_info to namespace.{c,h}

It's much more appropriate there and makes start.{c,h} cleaner and leaner.

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>


  Commit: a052913dd020b73a0881e9f5697e03885b3ca298
      https://github.com/lxc/lxc/commit/a052913dd020b73a0881e9f5697e03885b3ca298
  Author: Christian Brauner <christian.brauner at canonical.com>
  Date:   2016-11-19 (Sat, 19 Nov 2016)

  Changed paths:
    M src/lxc/attach.c
    M src/lxc/utils.c

  Log Message:
  -----------
  attach, utils: bugfixes

- simply check /proc/self/ns
- improve SYSERROR() report
- use #define to prevent gcc & clang to use a VLA

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>


  Commit: 88a66d011255063224d88f43e28196ee55082f16
      https://github.com/lxc/lxc/commit/88a66d011255063224d88f43e28196ee55082f16
  Author: Serge Hallyn <serge at hallyn.com>
  Date:   2016-11-19 (Sat, 19 Nov 2016)

  Changed paths:
    M src/lxc/attach.c
    M src/lxc/conf.c
    M src/lxc/conf.h
    M src/lxc/error.c
    M src/lxc/lxc_user_nic.c
    M src/lxc/namespace.c
    M src/lxc/namespace.h
    M src/lxc/start.c
    M src/lxc/start.h
    M src/lxc/utils.c
    M src/lxc/utils.h

  Log Message:
  -----------
  Merge pull request #1255 from brauner/2016-10-27/cleanup_netdevs_lxd#2439_lxc#1253

remove veth device from host


Compare: https://github.com/lxc/lxc/compare/122aaf509465...88a66d011255


More information about the lxc-devel mailing list