Comment 10 for bug 350936

Revision history for this message
Soren Hansen (soren) wrote :

Note to anyone implementing this (maybe I'll get around to it myself, but not right now):

It's important to remember that libvirt intentionally does not kill VM's on termination. This enables us to upgrade libvirt without interruping running VM's, so we want to only conditionally shut down VM's. What I've done on one of my Hardy boxes is to check $0 to see if the init script was invoked as K??libvirt-bin. If so, I assume we're being shut down and then I go and shut down the virtual machines. If invoked any other way, it just stops libvirt, not the VM's. To achieve something similar with upstart jobs, there's an environment variable that tells us why libvirt-bin is being stopped. This will reveal whether it's being shut down as a result of shutdown being called or whatnot.