[libvirt] PATCH: Experimental User Mode Linux driver for libvirt

Daniel P. Berrange berrange at redhat.com
Thu Oct 16 15:02:13 UTC 2008


On Thu, Oct 16, 2008 at 04:59:24PM +0200, Daniel Veillard wrote:
> On Thu, Oct 16, 2008 at 12:42:17PM +0100, Daniel P. Berrange wrote:
> [...]
> > 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.
> 
>   Seems then that this driver could be made restarteable easilly in case
> of libvirtd shutdown/restart, right ? Since everything is available from
> the filesystem and there is no tight coupling between libvirtd and
> the uml process, it even seems a starting libvirtd would be able to
> discover and manage uml instances which were not started with libvirt,
> right ?

Yes, this was written with restartability in mind - all I need to add is
saving of the live XML config, and re-connecting to the monitor socket,
and it'll all survive daemon restarts - this was the core motivation
for completely daemonizing the child processes & using inotify to monitor
their birth & death.

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




More information about the libvir-list mailing list