[libvirt] auto shutdown for qemu / kvm

Hello, there is the possibility to autostart a (qemu/kvm) domain. If libvirtd is stopped this domain is killed and the filesystem is in a unclean state. I miss the possible of an 'autostop' option that will shutdown a (qemu/kvm) domain if libvirtd is stopped. I changed the init script of my system (opensuse 11.0) to implement the 'autostop' option. Is there a simpler solution? Do you have tips how to improve the script? Matthias ## Path: System/Virtualization ## Description: libvirtd stop configuration ## Type: yesno ## Default: yes # # On 'libvirtd stop' all running (kvm) domains are killed. If # LIBVIRTD_KVM_SHUTDOWN is set to 'yes' all running vm's are given time # for a gracefully shutdown. # LIBVIRTD_KVM_SHUTDOWN="yes" ## Path: System/Virtualization ## Description: libvirtd timeout ## Type: integer ## Default: 300 # # On 'libvirtd stop' the vm's are ask to shutdown. This optine gives the # maximum number of seconds the script will wait until libvirt is stopped. # LIBVIRTD_KVM_SHUTDOWN_MAXWAIT=300

On Sat, Jul 12, 2008 at 10:25:01PM +0200, Matthias Pfafferodt wrote:
Hello,
there is the possibility to autostart a (qemu/kvm) domain. If libvirtd is stopped this domain is killed and the filesystem is in a unclean state. I miss the possible of an 'autostop' option that will shutdown a (qemu/kvm) domain if libvirtd is stopped.
I changed the init script of my system (opensuse 11.0) to implement the 'autostop' option. Is there a simpler solution? Do you have tips how to improve the script?
This functionality doesn't belong in the initscripts. It needs to be done as part of the individual hypervisor drivers, so for example, it can be delegated to XenD daemon, and behaviour controlled on a per VM basis via the API. Many OS don't even use the initscript managing the libvirtd daemon via a service management framework, like Upstart. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Hello Daniel, Am Dienstag, 15. Juli 2008 21:17:04 schrieb Daniel P. Berrange:
On Sat, Jul 12, 2008 at 10:25:01PM +0200, Matthias Pfafferodt wrote:
Hello,
there is the possibility to autostart a (qemu/kvm) domain. If libvirtd is stopped this domain is killed and the filesystem is in a unclean state. I miss the possible of an 'autostop' option that will shutdown a (qemu/kvm) domain if libvirtd is stopped.
I changed the init script of my system (opensuse 11.0) to implement the 'autostop' option. Is there a simpler solution? Do you have tips how to improve the script?
This functionality doesn't belong in the initscripts. It needs to be done as part of the individual hypervisor drivers, so for example, it can be delegated to XenD daemon, and behaviour controlled on a per VM basis via the API. Many OS don't even use the initscript managing the libvirtd daemon via a service management framework, like Upstart.
I know that the init script of libvirt is not the right place. I would like to have an option within libvirt to do this. The script I have will work for kvm, but for xen ... ? If you say 'per VM basis' does this mean an option within the xml definition of VM is the right way to go? On start / stop of libvirtd the corresponding actions would have to be initiated (like shutdown all kvm VMs). So a framework is needed to define which actions should be done an start / stop of the daemon and an implementation for each hypervisor. Kind regards Matthias
Daniel
participants (2)
-
Daniel P. Berrange
-
Matthias Pfafferodt