All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] [FW: [libvirt] PATCH: Experimental User Mode Linux driver for libvirt]
@ 2008-10-16 11:50 Daniel P. Berrange
  2008-10-17  8:14 ` Ron Yorston
  2008-10-20 15:24 ` Ron Yorston
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel P. Berrange @ 2008-10-16 11:50 UTC (permalink / raw)
  To: user-mode-linux-devel

Support for User Mode Linux in libvirt[1] may be of interest to people
on this list.

Regards,
Daniel

[1] http://libvirt.org/

----- Forwarded message from "Daniel P. Berrange" <berrange@redhat.com> -----

> Date: Thu, 16 Oct 2008 12:42:17 +0100
> From: "Daniel P. Berrange" <berrange@redhat.com>
> To: libvir-list@redhat.com
> Cc: jdike@karaya.com
> Subject: [libvirt] PATCH: Experimental User Mode Linux driver for libvirt
> 
> This patch implements a driver supporting User Mode Linux guests. User mode
> linux is a kind of paravirtualized kernel which runs on a plain Linux host.
> It requires no elevated privileges at all, except for some of the network
> integration. It is a pretty straightforward thing to invoke, so I figured
> it would be easy to write a driver to support it. I was right :-)
> 
> As with the QEMU driver, there are two styles of invocation
> 
>   uml:///system  - a single privileged, per host driver instance as root
>   uml:///session - a per-user unprivileged instance
> 
> The user mode linux docs recommend against running as root, so naturally
> I recommend use of uml:///session, though my testing is so far with
> uml:///system.
> 
> It supports the bare minimum  neccessary for a libvirt driver, namely start,
> stop, define, create, destroy, undefine against domains. For configuration
> it supports setting of memory limit, virtual disk devices, and paravirt
> console devices - good enough to get 'virsh console' working over a PTY,
> and dump XML config.
> 
> Like QEMU, UML has an admin monitor console. It is a little different
> though, using a UNIX domain socket, in datagram mode, sending command
> strings back & forth. This actaully makes it a little easier to deal
> with in libvirt. User mode linux has a uml_mconsole command line tool
> to interact with it, but I directly implement the socket support in
> libvirt instead, so this driver does not (yet) have any dependancy on
> the UML utilities.
> 
> The driver is largely a clone of the QEMU driver, replacing the bit which
> builds the command line argv, and all code dealing with the QEMU monitor.
> Since the monitor socket is datagram based, we can't make use of it for
> detecting VM shutdown  as we do with QEMU/LXC. So instead, I make use of
> inotify, to monitor $HOME/.uml which is populated witha directory for
> each VM. When we see a directory created, libvirt marks the corresponding
> VM as running, finds it PID & probes the monitor for the PTY config. When
> we see a directory deleted, libvirt makes the VM as shutoff and frees any
> resources its holding. This actually works very nicely & simply.
> 
> An example config I'm using for testing is
> 
> <domain type='uml'>
>   <name>demo</name>
>   <uuid>b4433fc2-a22e-ffb3-0a3d-9c173b395800</uuid>
>   <memory>500000</memory>
>   <os>
>     <type arch='x86_64'>uml</type>
>     <kernel>/home/berrange/linux</kernel>
>   </os>
>   <devices>
>     <disk type='file' device='disk'>
>       <source file='/home/berrange/FedoraCore6-AMD64-root_fs'/>
>       <target dev='ubd0' bus='uml'/>
>     </disk>
>     <console type='pty'>
>        <target port='0'/>
>     </console>
>     <serial type='tcp'>
>        <source mode='bind' host='localhost' service='9000'/>
>        <target port='0'/>
>     </serial>
>     <serial type='pty'>
>        <target port='3'/>
>     </serial>
>   </devices>
> </domain>
> 
> The user mode linux kernel, has the device emulator built-in, so there's no
> need to specify the device emulator path explicitly. The kernel I built
> straight from latest 2.6.27 sources, and the root filesystem I downloaded
> from the UML website. I've been testing with latest libvirt CVS, on  a
> Fedora 9 x86_64 host.
> 
> If you save that config to a file 'demo.xml', you ought to be able todo
> 
>    virsh --connect uml:///system define demo.xml
>    virsh --connect uml:///system start demo
>    virsh --connect uml:///system console demo
> 
> Though  there is still a small race whereby we can ask for the PTY device
> before its been created, causing console to fail.
> 
> If things go wrong /var/log/libvirt/uml/$NAME.log contains log messages,
> The configuration is stored in /etc/libvirt/uml/$NAME.xml, or in
> $HOME/.libvirt/uml/$NAME.xml, and you can also query stuff with mconsole
> by doing  'uml_mconsole $NAME'
> 
> This isn't quite ready to merge, but I thought I'd send it here to make
> people aware of it.
> 
>  configure.in                |    8 
>  include/libvirt/virterror.h |    1 
>  src/Makefile.am             |    9 
>  src/domain_conf.c           |   47 -
>  src/domain_conf.h           |    1 
>  src/driver.h                |    3 
>  src/libvirt.c               |    6 
>  src/qemu_conf.c             |    3 
>  src/remote_internal.c       |   16 
>  src/uml_conf.c              |  404 ++++++++++
>  src/uml_conf.h              |   72 +
>  src/uml_driver.c            | 1771 ++++++++++++++++++++++++++++++++++++++++++++
>  src/uml_driver.h            |   34 
>  src/virterror.c             |    4 
>  14 files changed, 2355 insertions(+), 24 deletions(-)
> 
> 
> Daniel
----- End forwarded message -----

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [uml-devel] [FW: [libvirt] PATCH: Experimental User Mode Linux driver for libvirt]
  2008-10-16 11:50 [uml-devel] [FW: [libvirt] PATCH: Experimental User Mode Linux driver for libvirt] Daniel P. Berrange
@ 2008-10-17  8:14 ` Ron Yorston
  2008-10-20 15:24 ` Ron Yorston
  1 sibling, 0 replies; 4+ messages in thread
From: Ron Yorston @ 2008-10-17  8:14 UTC (permalink / raw)
  To: user-mode-linux-devel, berrange

"Daniel P. Berrange" <berrange@redhat.com> wrote:
>Support for User Mode Linux in libvirt[1] may be of interest to people
>on this list.

Very much so.  Thanks Daniel, I'll certainly have a look at thing when
I have a chance.

Ron

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [uml-devel] [FW: [libvirt] PATCH: Experimental User Mode Linux driver for libvirt]
  2008-10-16 11:50 [uml-devel] [FW: [libvirt] PATCH: Experimental User Mode Linux driver for libvirt] Daniel P. Berrange
  2008-10-17  8:14 ` Ron Yorston
@ 2008-10-20 15:24 ` Ron Yorston
  2008-10-20 19:11   ` Daniel P. Berrange
  1 sibling, 1 reply; 4+ messages in thread
From: Ron Yorston @ 2008-10-20 15:24 UTC (permalink / raw)
  To: user-mode-linux-devel, berrange

I've now had a chance to try out the UML driver for libvirt.  My host
platform was CentOS 5 and the guest CentOS 4, with a 2.6.27.2 kernel
configured as 'make defconfig ARCH=um'.  I used uml:///session as an
unprivileged user.

The CVS snapshot tarball on the libvirt.org ftp site was out of date:
use the cvs command to fetch the source.

My host system hadn't been set up for UML before so virsh didn't work
until I'd:

   created the directory ~/.uml (which doesn't exist if you haven't
   run a UML instance yet);

   installed the UML utilities (because libvirt checks that uml_mconsole
   exists, even though it doesn't use it).

Once I'd figured that out I was able to start a virtual machine from
virsh and see it using the list command.

However, connecting to the guest's console was very unreliable (No
console available for domain).  Also, all attempts to shut down the
guest from virsh failed (libvir: Remote error :  socket closed
unexpectedly).  Once that had happened the domain was no longer shown
by the list command.

BTW, is there a way to disconnect from the guest console?

Ron

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [uml-devel] [FW: [libvirt] PATCH: Experimental User Mode Linux driver for libvirt]
  2008-10-20 15:24 ` Ron Yorston
@ 2008-10-20 19:11   ` Daniel P. Berrange
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrange @ 2008-10-20 19:11 UTC (permalink / raw)
  To: Ron Yorston; +Cc: user-mode-linux-devel

On Mon, Oct 20, 2008 at 04:24:26PM +0100, Ron Yorston wrote:
> I've now had a chance to try out the UML driver for libvirt.  My host
> platform was CentOS 5 and the guest CentOS 4, with a 2.6.27.2 kernel
> configured as 'make defconfig ARCH=um'.  I used uml:///session as an
> unprivileged user.
> 
> The CVS snapshot tarball on the libvirt.org ftp site was out of date:
> use the cvs command to fetch the source.
> 
> My host system hadn't been set up for UML before so virsh didn't work
> until I'd:
> 
>    created the directory ~/.uml (which doesn't exist if you haven't
>    run a UML instance yet);

Ah, that's useful info - I would never have noticed that :-)

>    installed the UML utilities (because libvirt checks that uml_mconsole
>    exists, even though it doesn't use it).

Yep, that check is now obsolete, so I'll remove it.

> Once I'd figured that out I was able to start a virtual machine from
> virsh and see it using the list command.
> 
> However, connecting to the guest's console was very unreliable (No
> console available for domain).  Also, all attempts to shut down the
> guest from virsh failed (libvir: Remote error :  socket closed
> unexpectedly).  Once that had happened the domain was no longer shown
> by the list command.

Ok, that's a bug I'll look into.

> BTW, is there a way to disconnect from the guest console?

We follow the telnet defaults, and use 'Ctrl+]' sequence

Thanks for taking the time to test out this initial code, hopefully I'll 
get this polished up and incorporated in the next libvirt release.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-10-20 19:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-16 11:50 [uml-devel] [FW: [libvirt] PATCH: Experimental User Mode Linux driver for libvirt] Daniel P. Berrange
2008-10-17  8:14 ` Ron Yorston
2008-10-20 15:24 ` Ron Yorston
2008-10-20 19:11   ` Daniel P. Berrange

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.