[libvirt] libvirtd shutdown script patches

Sir Woody Hackswell hackswell at gmail.com
Wed Jan 14 11:48:54 UTC 2009


On Wed, Jan 14, 2009 at 5:58 AM, Daniel P. Berrange <berrange at redhat.com> wrote:
> On Tue, Jan 13, 2009 at 03:00:17PM -0500, Sir Woody Hackswell wrote:
>
> 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.

A kill-only script, effectively?  start() would be null, and stop()
would shutdown or save or whatever is needed.

> 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 all the
> functional / timeout / waiting logic was in the daemon.

This was my thought.  Since libvirtd autostarts some domains, it
should cleanly stop when it is time for shutdown (not necessarily at
the death of libvirtd).  If we put something in for startup, we
shouldn't have to script it on shutdown, IMHO.

Shutdown: (Replace "libvirtd" with virsh as needed)
libvirtd --shutdown-all
libvirtd --migrate-all new.server.com
libvirtd --snapshot-all
libvirtd --die-domains-die             ;)


Startup:
libvirtd (startup, "intelligently" determines how it previously shut
down domains, and reverses it)


-- 
-Sir Woody Hackswell




More information about the libvir-list mailing list