[Libvir] A sample program to create a Linux Container

Daniel P. Berrange berrange at redhat.com
Fri Jan 25 19:35:02 UTC 2008

On Fri, Jan 25, 2008 at 11:30:35AM -0800, Dave Leskovec wrote:
> Daniel Hokka Zakrisson wrote:
> >Dave Leskovec wrote:
> >  
> >>Attached is a simple program that uses the clone() function to create a
> >>container.  This is not intended as a patch - just an example of what
> >>creating a Linux Container looks like.  Something along these lines will
> >>be used by the Linux Container driver to start the domain.  The code run
> >>within this container is really simple.  It just mounts the /proc file
> >>system and then dumps the ps output to a file showing that the container
> >>is in separate process space.
> >>
> >>To run this you will need to have PID namespaces support enabled.  Turn
> >>on CONFIG_PID_NS when compiling the kernel.  You must run the program as
> >>root or the clone() call will fail.
> >>
> >>Any questions or comments are welcome.  Thanks!
> >>    
> >
> >You want to use at least CLONE_NEWIPC and CLONE_NEWUSER too. CLONE_NEWUTS
> >is probably desired as well, so you can have different hostnames, and
> >CLONE_NEWNET for networking (though that's probably not going to be usable
> >until after 2.6.25, at least).
> >
> >  
> caused clone() to fail.  I'm looking into that.
> I'll post in the near future regarding CLONE_NEWNET, network support for 
> containers, and the XML format.

BTW, I meant to say - don't let the XML format discussions delay writing
of the actual driver code. From previous postings we've clearly got a
good common understanding of the scope of the data needed in the XML, it
is just agreeing on fine details of element names & attribute names. THis
can easily be tweaked during course of development as things become 
clearer, since its only changing XPath expressions really.

|=- 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