[libvirt] [PATCH 3/3] Add new libvirt-babysitter tool

Daniel P. Berrange berrange at redhat.com
Tue Oct 9 11:22:54 UTC 2012


On Tue, Oct 09, 2012 at 01:18:56PM +0200, Alexander Larsson wrote:
> On tis, 2012-10-09 at 12:14 +0100, Daniel P. Berrange wrote:
> > On Mon, Oct 08, 2012 at 04:57:49PM +0200, Alexander Larsson wrote:
> > > This helper registers with the session bus and libvirt and ensures
> > > that we properly save the state when the session exits. It does this
> > > in two ways:
> > > 
> > > 1) Whenever the session dbus connection is disconnected (typically due
> > > to a logout) we save all domains in the session libvirtd.
> > > 
> > > 2) Whenever there is a active domain in the session libvirtd we
> > > take a shutdown inhibition lock[1] which means that systemd will
> > > delay shutdown until we saved any active VMs. We then save the VM
> > > when we get a PrepareForShutdown event (or when the session dies as
> > > in 1).
> > > 
> > > [1] http://www.freedesktop.org/wiki/Software/systemd/inhibit
> > 
> > 
> > In general I think this is a neat idea. We currently have a nasty
> > shell script that we trigger on host shutdown to save/migrate/etc
> > VMs. Although it is not as featureful, I like that this code is
> > using our APIs instead of shell code.
> > 
> > My primary feedback would be that this could actually be run
> > inside libvirtd itself.
> 
> Ok, I'll try that out then.
> 
> Btw, how do i tell libvirtd to exit? Just call exit(0)?

The best way is to call virNetServerQuit() on the virNetServerPtr object
since this allows it todo graceful cleanup

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list