[Pkg-libvirt-maintainers] Bug#501155: Bug#501155: Please add script for automatic restart of kvm-based instances

Guido Günther agx at sigxcpu.org
Sun Oct 5 12:48:18 UTC 2008


Hi Andreas,

On Sat, Oct 04, 2008 at 11:13:53PM +0200, Andreas Barth wrote:
> this scripts works for me, I added it with
> update-rc.d libvirt-suspendonreboot defaults 21 19
> 
> Nothing too great, but it makes sure kvm-domains survive a reboot of the host
> machine (and it doesn't check for possible symlink attacks in
> /var/lib/libvirt/autosuspend, so make sure that directory is root-only).
thanks a lot - this is an area where libvirt currently isn't doing too
well! I wonder if we should hook this directly into
/etc/init.d/libvirt-bin in the long run. We could even offer to either
shutdown or suspend the vms via (/etc/default/libvirt-bin)
shutdown_action="shutdown|suspend" then. I'm currently discussing with
upstream what would be the best thing to do - e.g. in case of a restart
we should simply keep the VMs running.

Below is some minor nitpicking:

[..snip..] 
>     for domain in ${suspenddir}/*dump; do
>         if [ -f $domain ]; then
>             domain=$(basename $domain .dump)
>             echo "resuming $domain ..."
>             virsh restore ${suspenddir}/${domain}.dump && rm ${suspenddir}/${domain}.dump
Do we want to keep the dump file around in case the restore failed?
Should we add some lsb logging in case the restore failed?

>         fi
>     done
>     ;;
>   stop)
>     for domain in /etc/libvirt/qemu/*xml; do
>         domain=$(basename $domain .xml)
>         state=$(virsh domstate $domain)
>         if [ "$state" == "running" ]; then
We probably want to pass the URI here like "virsh -c qemu:///system" so
we don't clash with people using xen and we also don't handle
"transient" domains (virsh create).
 -- Guido





More information about the Pkg-libvirt-maintainers mailing list