While there's many solutions now to shutdown VM's, here's my 2 cents. Instead 
of a libvirt-bin.conf script, I made a separate script 
(/usr/local/sbin/shutdown-libvirt-hosts.sh). This script waits 120 seconds for 
all VM's to shut down. Then I'm running this script from two places; in 
libvirt-bin.conf:
pre-stop script
        /usr/local/sbin/shutdown-libvirt-hosts.sh
end script

And also (as a link) from /etc/rc0.d/K10shutdown-libvirt-hosts (and from
rc6.d alike)

This way, the "sendsigs" script will only run if all VMs have 
terminated.?field.comment=While there's many solutions now to shutdown VM's, 
here's my 2 cents. Instead of a libvirt-bin.conf script, I made a separate 
script (/usr/local/sbin/shutdown-libvirt-hosts.sh). This script waits 120 
seconds for all VM's to shut down. Then I'm running this script from two 
places; in libvirt-bin.conf:
pre-stop script
        /usr/local/sbin/shutdown-libvirt-hosts.sh
end script

And also (as a link) from /etc/rc0.d/K10shutdown-libvirt-hosts (and from
rc6.d alike)

With a K10shutdown-libvirt-hosts script in place, the "sendsigs" script
will only run after this script has ended, which is when all VMs have
terminated.

A few remarks:
- shutting down the VM's twice is not a problem; to the VM, it just looks like 
pressing the power button twice.
- to gracefully shut down, the VM's need the "acpid" package installed.
- if the shutdown script searches for the word "running" (like mine does, but 
John Morrissey's script is affected, too), it must set LANG=C at the top, 
otherwise virsh will run in the local language.

** Attachment added: "shutdown-libvirt-hosts.sh"
   
https://bugs.launchpad.net/ubuntu/+source/kvm/+bug/350936/+attachment/1621772/+files/shutdown-libvirt-hosts.sh

-- 
Should shut down domains on system shutdown
https://bugs.launchpad.net/bugs/350936
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to