[Libvir] [RFC] 0/3 Add Linux Container support to libvirt

Daniel P. Berrange berrange at redhat.com
Thu Feb 21 14:51:12 UTC 2008


On Wed, Feb 20, 2008 at 10:24:18PM -0800, Dave Leskovec wrote:
> The following set of patches add the first batch of linux container 
> support to libvirt.  The work is not complete but I wanted to start 
> getting some of this out for comments.  This set of patches supports the 
> following:
> 
> * new switch --with-lxc to enable linux container support (off by default)
> * virConnectOpen
> * virConnectClose
> * virConnectListDomains (of course none are listed since we can't start 
> the containers yet)
> * virConnectNumOfDomains
> * virConnectListDefinedDomains
> * virConnectNumOfDefinedDomains
> * virDomainLookupByUUID
> * virDomainLookupByName
> * virDomainGetInfo
> * virDomainGetXMLDesc
> * virDomainDefineXML
> * virDomainUndefine
> 
> A sample XML format that can be used to define a linux container domain:
> <domain type='linuxcontainer'>
>    <name>TestContainer3</name>
>    <container>
>        <filesystem type='mount'>
>            <source dir='/home/user/lxc_files/etc/'/>
>            <target dir='/etc/'/>
>        </filesystem>
>        <filesystem type='mount'>
>            <source dir='/home/user/lxc_files/var/'/>
>            <target dir='/var/'/>
>        </filesystem>
>        <init>/usr/sbin/container_init</init>
>    </container>
>    <memory>65536</memory>
>    <devices>
>        <console tty='/dev/pts/4'/>
>    </devices>
> </domain>

Having thought about this all since our previous round of discussions on
the matter I'm of the opinion we should /not/ use the <container> block
for filesystem setup - it should be part of the <devices> block. This will
simplify impl for apps which already have support for dealing with devices
and hot add/remove (virDomainAttachDevice/virDomainDetachDevice). The 
<init> element can stay in <container> or perhap go inside an <os> block
since that's where we describe  booting for non-container virt.

WRT to OpenVZ driver already using <container> we can change it to follow
the new style - if we need compat we can let it continue to parse the old
style too.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list