This patchset try to add userns support for libvirt lxc.
Since userns is nearly completed in linux-3.9, the old
kernel doesn't support userns, I add some New XML elements
to let people decide if enable userns.The userns is enabled
only when user configure the XML.
The format of user namespace related XML file like below:
<idmap>
<uid start='0' target='1000' count='10'>
<gid start='0' target='1000' count='10'>
</idmap>
it means the user in container (which uid:gid is 0:0) will
be mapped to the user in host (uid:gid is 1000:1000), count
is used to form an u/gid range: The users in container which
uid in [start, start + count -1] will be mapped.
You can have multiple lines to map differnet id ranges,
caution, you must make sure the root user of container has
been mapped.
This patchset also does the below jobs.
1, Because the uninit userns has no right to create devices,
we should create devices for container on host.
2, Changes the owner of fuse and tty device.
Gao feng (8):
LXC: Introduce New XML element for user namespace
LXC: enable user namespace when user set the uidmap
LXC: sort the uidmap/gidmap of domain
LXC: introduce virLXCControllerSetupUserns and lxcContainerSetUserns
LXC: Creating devices for container on host side
LXC: change the owner of devices created on host
LXC: change the owner of tty devices to the root user of container
LXC: fuse: Change files owner to the root user of container
docs/formatdomain.html.in | 23 +++++
docs/schemas/domaincommon.rng | 28 ++++++
src/conf/domain_conf.c | 111 +++++++++++++++++++++
src/conf/domain_conf.h | 19 ++++
src/lxc/lxc_container.c | 120 +++++++++++------------
src/lxc/lxc_controller.c | 218 +++++++++++++++++++++++++++++++++++++++++-
src/lxc/lxc_fuse.c | 6 ++
7 files changed, 455 insertions(+), 70 deletions(-)
--
1.8.1.4