[Libvir] [PATCH 1/2] lxc: start container

Dave Leskovec dlesko at linux.vnet.ibm.com
Wed Apr 9 00:03:02 UTC 2008


This is a repost of the start container support.  Changes from the last version:

* Report an error when allocation for init string fails in lxcExecContainerInit()
* Change to find by name in lxcStartDomain()
* Move tty forwarding process outside of the container.  This allows
consolidating the forwarding into a single process at a later time.  This also
means the the container init process as specified by the user now runs as the
container root process with pid = 1.  The tty setup will require some (hopefully
minor) modifications when pts namespaces are enabled.
* Add header comments to a number of the functions.

This is an updated rough outline of the functions involved in starting a
container and the namespace and process under which they run:
lxcVmStart() - runs under libvirtd process
    lxcSetupTtyTunnel() - opens and configures parent tty
    lxcSetupContainerTty() - opens container tty
    fork
        child process calls lxcTtyForward() see below
        parent continues
    lxcStartContainer - see below
    return

lxcStartContainer() - runs in parent namespace, libvirtd process
    Allocate stack for container
    clone() - child process will start in lxcChild() see below
    return

lxcChild() - runs within container, child process from clone()
    mount user filesystems
    mount container /proc
    lxcExecWithTty() - see below, will not return

lxcExecWithTty() - runs within container, root process
    lxcSetContainerStdio - sets container tty as primary console
    lxcExecContainerInit - see below, should not return
    exit()

lxcExecContainerInit() - runs within container, root process
    exec containers init
    if exec fails, exit()

Thanks!

-- 
Best Regards,
Dave Leskovec
IBM Linux Technology Center
Open Virtualization

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lxc_start.patch
Type: text/x-patch
Size: 21264 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080408/f3853d71/attachment-0001.bin>


More information about the libvir-list mailing list