[lxc-devel] [lxc/lxc] 08dd28: add a start-host hook (v2)

GitHub noreply at github.com
Sun Oct 1 01:16:44 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 08dd280543e1013dc1a47176167a9572b5450eb8
      https://github.com/lxc/lxc/commit/08dd280543e1013dc1a47176167a9572b5450eb8
  Author: Serge Hallyn <shallyn at cisco.com>
  Date:   2017-09-30 (Sat, 30 Sep 2017)

  Changed paths:
    M doc/lxc.container.conf.sgml.in
    M src/lxc/conf.c
    M src/lxc/conf.h
    M src/lxc/confile.c
    M src/lxc/start.c
    M src/lxc/sync.h

  Log Message:
  -----------
  add a start-host hook (v2)

This should satisfy several use cases.  The one I tested for was CNI.
I replaced the network configuration in a root owned container with:

lxc.net.0.type = empty
lxc.hook.start-host = /bin/lxc-start-netns

where /bin/lxc-start-netns contained:

=================================

echo "starting" > /tmp/debug
ip link add host1 type veth peer name peer1
ip link set host1 master lxcbr0
ip link set host1 up
ip link set peer1 netns "${LXC_PID}"
=================================

The nic 'peer1' was placed into the container as expected.

For this to work, we pass the container init's pid as LXC_PID in
an environment variable, since lxc-info cannot work at that point.

Signed-off-by: Serge Hallyn <shallyn at cisco.com>


  Commit: 31f460b26815867706ef143c4990bdc95cb2cce2
      https://github.com/lxc/lxc/commit/31f460b26815867706ef143c4990bdc95cb2cce2
  Author: Serge Hallyn <serge at hallyn.com>
  Date:   2017-09-30 (Sat, 30 Sep 2017)

  Changed paths:
    M doc/lxc.container.conf.sgml.in
    M src/lxc/conf.c
    M src/lxc/conf.h
    M src/lxc/confile.c
    M src/lxc/start.c
    M src/lxc/sync.h

  Log Message:
  -----------
  Merge pull request #1826 from hallyn/2017-09-21.pre-start-host

add a pre-start-host hook


Compare: https://github.com/lxc/lxc/compare/08dc351a3623...31f460b26815


More information about the lxc-devel mailing list