ContainersSpec

Differences between revisions 1 and 2
Revision 1 as of 2009-11-26 21:08:00
Size: 5243
Editor: 95
Comment: Dump gobby document from BOF
Revision 2 as of 2009-11-26 22:14:40
Size: 6122
Editor: 95
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
 * '''Contributors''':  * '''Contributors''': SorenHansen
Line 10: Line 10:
Containers offer a simple way to confine processes to a particular namespace. LXC is the container technology in the upstream kernel, and it provides an excellent upgrade path for people using the openvz kernel we had in Hardy. It does not require special hardware support, so in situations where kvm doesn't work it might offer people a saner alternative to Xen :)
Line 14: Line 14:
This section should include a paragraph describing the end-user impact of this change. It is meant to be included in the release notes of the first release in which it is implemented. (Not all of these will actually be included in the release notes, at the release manager's discretion; but writing them is a useful exercise.)

It is mandatory.
Ubuntu 9.10 offers container based virtualisation. LXC, the container technology in Linux, offers a lightweight way to subdivide system ressources, while still allowing each subdivision full control (root access) to its part of the system. This can be used to provide very high density "virtual machines" with very little effort.
Line 20: Line 18:
This should cover the _why_: why is this change being proposed, what justifies it, where we see this justified. LXC is in the upstream kernel. It's very useful, and the amount of work to make it work in Ubuntu is minimal.
Line 24: Line 22:
== Assumptions == 1. Stéphane used the OpenVZ kernel shipped in Hardy. With a new LTS coming out he would like to upgrade, but we no longer ship an OpenVZ kernel. LXC provides a sane upgrade path.
1. Soren has an old machine that does not support KVM. He does not enjoy Xen, and being an Ubuntu fanatic, all his VM's are Ubuntu based anyway, so he uses LXC containers as a poor man's virtual machines.
1. Lamont manages the Ubuntu buildd's. Builds are traditionally run in chroots, but containers offer better isolation, so he wants to use it as a drop-in replacement for chroot.
Line 28: Line 28:
You can have subsections that better describe specific parts of the issue. Upstream libvirt already supports LXC. We should make sure it's in good shape for Lucid.

We should make it easier to build containers.

Perhaps we should provide ready made containers for people to use if they're running other host OS's?
Line 32: Line 36:
This section should describe a plan of action (the "how") to implement the changes discussed. Could include subsections like: LXC support in libvirt is currently broken due to [[https://bugs.edge.launchpad.net/ubuntu/+source/libvirt/+bug/480478|apparmour being too restrictive]]. This is being addressed.
Line 34: Line 38:
=== UI Changes === Libvirt needs to be built against libcap-ng to be able to drop certain CAPabilities (thus properly containing the containers).
Line 36: Line 40:
Should cover changes required to the UI, or specific UI that is required to implement this

=== Code Changes ===

Code changes should include an overview of what needs to change, and in some cases even the specific details.

=== Migration ===

Include:
 * data migration, if any
 * redirects from old URLs to new ones, if any
 * how users will be pointed to the new way of doing things, if necessary.
We will extend VMBuilder to let it build "chroots" for LXC.

Summary

Containers offer a simple way to confine processes to a particular namespace. LXC is the container technology in the upstream kernel, and it provides an excellent upgrade path for people using the openvz kernel we had in Hardy. It does not require special hardware support, so in situations where kvm doesn't work it might offer people a saner alternative to Xen Smile :)

Release Note

Ubuntu 9.10 offers container based virtualisation. LXC, the container technology in Linux, offers a lightweight way to subdivide system ressources, while still allowing each subdivision full control (root access) to its part of the system. This can be used to provide very high density "virtual machines" with very little effort.

Rationale

LXC is in the upstream kernel. It's very useful, and the amount of work to make it work in Ubuntu is minimal.

User stories

1. Stéphane used the OpenVZ kernel shipped in Hardy. With a new LTS coming out he would like to upgrade, but we no longer ship an OpenVZ kernel. LXC provides a sane upgrade path. 1. Soren has an old machine that does not support KVM. He does not enjoy Xen, and being an Ubuntu fanatic, all his VM's are Ubuntu based anyway, so he uses LXC containers as a poor man's virtual machines. 1. Lamont manages the Ubuntu buildd's. Builds are traditionally run in chroots, but containers offer better isolation, so he wants to use it as a drop-in replacement for chroot.

Design

Upstream libvirt already supports LXC. We should make sure it's in good shape for Lucid.

We should make it easier to build containers.

Perhaps we should provide ready made containers for people to use if they're running other host OS's?

Implementation

LXC support in libvirt is currently broken due to apparmour being too restrictive. This is being addressed.

Libvirt needs to be built against libcap-ng to be able to drop certain CAPabilities (thus properly containing the containers).

We will extend VMBuilder to let it build "chroots" for LXC.

Test/Demo Plan

It's important that we are able to test new features, and demonstrate them to users. Use this section to describe a short plan that anybody can follow that demonstrates the feature is working. This can then be used during testing, and to show off after release. Please add an entry to http://testcases.qa.ubuntu.com/Coverage/NewFeatures for tracking test coverage.

This need not be added or completed until the specification is nearing beta.

Unresolved issues

This should highlight any issues that should be addressed in further specifications, and not problems with the specification itself; since any specification with problems cannot be approved.

BoF agenda and discussion

While regular virtualization (kvm/virtualbox/vmware/...) is great, it still has to virtualize a whole computer including the BIOS and run its own kernel.

In most cases, it's not necessary and having some kind of "chroot" with quota on main resources (CPU, memory, network, disk) would be enough. That's what contextualization technologies let you do, the most known of which is probably OpenVZ (virtuoso) but Vserver and LXC also exist.

LXC is the mainline implementation of contextualization and is built-in the kernel since 2.6.28 and well working as of 2.6.31. It would be interesting that the next LTS (10.04) supports both virtualization and contextualization and so will cover everybody's needs.

Notes

  • stefan's ubuntu desktop is running in an LXC container
  • no graphics hardware available in LXC, uses NX for desktop access
  • Typical usage is dozens/hundreds of containers on one server. Each service (apache, postfix, etc) is isolated into its own container. Each container has root access, but no device access, so it's relatively secure.
  • File access is from a directory on the host. You can mount a loopback, etc.
  • Host can see all processes in ps; guests can only see their own
    • e.g. host sees 2 init processes, guest sees only 1 (and thinks it's process 1)
  • /dev is relatively bare
    • e.g. there's loop0, shm, urandom, zero, etc, but not the rest of the real hardware devices
    • It is however possible to give access to some devices by mknod and granting access to the container. For example, an asterisk server could access a telephony card.
  • Upstream KVM is looking at launching KVM's in containers
    • namespace
    • security
    • resource constraints

Use Cases for Containers

  • ltsp
  • canonical buildd's currently use chroots
  • some of canonical xen guests could be containers
  • ISP's are well suited to containers
  • Eucalyptus interacts with the hypervisor entirely through libvirt
    • could potentially have container machine types
    • need to investigate dynamic block attach
      • seems that this should be easy to do, actually
    • block device names would need to match ec2 semantics
  • KVM + LXC on same host
    • LXC inside a KVM guest
  • Package installation/upgrade testing
    • for i in contexts;do (in context) apt-get upgrade;done
  • 64bit ubuntu install with a 32bit ubuntu container

ACTIONS

  • Bug: #480739
    • Kernel config options that need to be turned on CONFIG_CGROUP_DEVICE=y CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y
    • Need to talk to the kernel team to do this
    • Might introduce some overhead to baremetal server kernels
      • can be disabled by boot option "noswapaccount" and there will be no overhead.
  • vm-builder would need to be able to bootstrap a container (soren)
    • soren "accidentally" implemented this last week
  • libvirt needs to build against libcapng
    • need to sync libcapng from Debian
  • Could port userspace lxc to main
  • enhance libvirt apparmor for lxc coverage (jdstrand)


CategorySpec

ContainersSpec (last edited 2009-11-30 11:26:24 by eth0)