Is there any way to make KVM automatically restart any VMs that have been shut down due to power failure? Here is my scenario: I run a small VM tank, mostly with development VMs on it. I now have a VM that is set to autostart on system boot, which works. I have installed apcupsd on that VM, reading from the daemon on the host, and configured to shut down when battery reaches 75%. The host will shut down when the battery reaches 15%. My question is, if power returns during this window (i.e. the host stays up), can I restart the VM that was shut down? I know I could hard-code a call to 'virsh start [VM name]' but I am looking to start any VM flagged as 'autostart', somewhat like doing 'mount -a' to mount all defined filesystems. Is this possible?
On my RHEL6 and CentOS6 that is established by creating a symbolic link to VM XML description in
/etc/libvirt/qemu/autostart/
:If you want to avoid setting up links manually:
virsh autostart <domain>