One nice feature I'm lacking with the current libvirt package (which otherwise is a pure delight :)) is the ability to have guests come up and down with the host. Or rather, come down as the autostart feature is already in place. Basically, I'd like a init.d script that triggers a "shutdown" on all guests when the host is going down and waits for them to terminate. A timeout and a forceful kill is probably also needed though. The best way is likely with a separate script, as you'd like to restart libvirtd without killing all your guests.
It seems the killing is the current behaviour. :/ So in the light of that, I'd like a tweak from the current forced kill, to a clean shutdown on service libvirtd stop.
Clean shutdown is not viable because this requires co-operation from the guest OS. There is no guarentee the guest will honour this request to shutdown even when operating normally, if the guest is operating abnormally it may not even see the event, and it may hang during shutdown with no way for libvirt to determine if it is still in process of shutting down, or has hung. Killing, or suspending VMs (save to disk) are the only viable options.
I agree, which is why I suggest the script _tries_ to shut them down cleanly, but then gets violent after a certain timeout. Basically the same behaviour as the SIGTERM/SIGKILL portion at the end of the system shutdown.
No, this is the behaviour that used to be present in Xen. It was removed because it frequently shot domains which were in fact still shutting down cleanly, simply taking a long time. There is no safe way todo timeouts on shutdown. Suspending to disk the only guarenteed safe option.
Triage here. Suggest CLOSED {WONTFIX,CANTFIX} then?
*** Bug 437204 has been marked as a duplicate of this bug. ***
Leave open. This still needs to be addressed in some way
I extended the init script for opensuse. It tries to shutdown all qemu / kvm domains and after a timeout all domains are killed (libvirtd.init and the sysconfig file libvirtd.sysconfig). Furthermore I also tested the possibility to save / restore domains. This works sometimes and sometimes not. At the moment I have it down that: - it works if I do stop / start without a reboot in between - using it for saving / restoring domains restore only returns an error (libvirtdomains.init and the sysconfig file libvirtdomains.sysconfig) I hope that the scripts are usefull. I'm not an expert using bash so there will be a lot of things which can be done better ...
Created attachment 330683 [details] init script for libvirtd
Created attachment 330684 [details] sysconfig file for libvirtd
Created attachment 330685 [details] init script for libvirtdomains
Created attachment 330686 [details] sysconfig file for libvirtdomains
(In reply to comment #8) > - using it for saving / restoring domains restore only returns an error some more info: if a domains is saved on shutdown it is _not_ restored on boot. even if I try to do it manually it is not restored. But doing a save / restory cycle using a running system all is OK.
Moving to Virtualization Tools product See also: http://www.redhat.com/archives/libvir-list/2009-January/msg00193.html
Also: https://www.redhat.com/archives/libvir-list/2009-July/msg00467.html
*** Bug 537270 has been marked as a duplicate of this bug. ***
FYI this thread describes the API enhancements required in libvirt in order to safely / reliably support managed shutdown at host halt http://www.redhat.com/archives/libvir-list/2009-March/msg00205.html
The APIs described have now been implemented & an corresponding initscript for auto-shutdown/save is now available commit 66823690e46944f17e195b1f82c5eee527ddee20 Author: Jiri Denemark <jdenemar> Date: Fri May 14 15:37:55 2010 +0200 Init script for handling guests on shutdown/boot
Excellent! I'll look forward to test this. From which package versions will it be available?
The next libvirt release will probably be 0.8.2