]> git.proxmox.com Git - mirror_lxc.git/commit
add a start-host hook (v2)
authorSerge Hallyn <shallyn@cisco.com>
Wed, 20 Sep 2017 21:22:46 +0000 (21:22 +0000)
committerSerge Hallyn <shallyn@cisco.com>
Sat, 30 Sep 2017 21:55:02 +0000 (21:55 +0000)
commit08dd280543e1013dc1a47176167a9572b5450eb8
treeab78b636633d98df46c082f1220af15a0bc7007b
parent08dc351a3623f171b58a65e091bc4f9711bd57d9
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@cisco.com>
doc/lxc.container.conf.sgml.in
src/lxc/conf.c
src/lxc/conf.h
src/lxc/confile.c
src/lxc/start.c
src/lxc/sync.h