[libvirt] libvirtd shutdown script patches

Daniel P. Berrange berrange at redhat.com
Wed Jan 14 10:58:31 UTC 2009


On Tue, Jan 13, 2009 at 03:00:17PM -0500, Sir Woody Hackswell wrote:
> Here is a small patch for libvirtd init and sysconfig script.  Before
> killing libvirtd, we virsh shutdown any running domains.  We also have
> a maximum time limit for shutdown (300 sec default), just in case the
> VM will not shut down.
> 
> Any thoughts as to whether this is the right place to put this
> functionality?  Is the shutdown script proper, or since libvirtd
> handles autostarts domains internally, should libvirtd shut down
> active domains upon SIGTERM all by itself?

We don't really want to stop anything when the daemon shuts down.

It is desirable to stop things when the machine is shutting down.

If we put this functionality in the stop() function of the initscript
we cannot make this distinction.

I thing this would thus have to go in a separate initscrpit that is
configured to run before the main libvirtd initscript. This ensures
that if admin just wants to stop/start the daemon, their domains
are not touched, but if the whole machine is shutdown, things are
cleanly shutdown.

Shutting down is not neccessarily the only thing an admin would want 
to do with guests. They may wish to save guests to a file. Or migrate
them to a separate machine. In the case of saving to a file, you ahve
the added complication that when libvirtd later starts on next boot,
instead of auto-starting, you want it to restore from the saved file.
This will entail additional logic in libvirtd. I also don't particularly
like having this functionality split between the init scripts and the
daemon, because the init script is neccessarily Red Hat specific, and
there's many other distros using libvirt. My preference would be to 
have an explicit way to tell libvirtd to shutdown/save all running guests
so initscript only needed a single command to do the job, and al the
functional / timeout / waiting logic was in the daemon.

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