How can I make my VMs reboot automatically if no bootable devices are found in QEMU/KVM?

When running a VM in QEMU/KVM, if no bootable devices are found the VM hangs. Is there a way to force it to reboot in that situation?

  • uname -a: Linux home-server 4.4.0-78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • libvirtd -V: libvirtd (libvirt) 1.3.1
  • kvm -version: QEMU emulator version 2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.14), Copyright (c) 2003-2008 Fabrice Bellard