3

Is it possible to detect that the guest VM has rebooted and perform an action using libvirt / qemu? The hooks here only support the "start" and "stop" events. I would like to detect if my VM has rebooted.

HOST is running ubuntu 10.04 GUEST is running ubuntu 10.04

bradgonesurfing
  • 261
  • 1
  • 4
  • 6

1 Answers1

1

The qemu message protocol (QMP) supports a number of asynchronous messages, including one about restart. If you start your qemu instance with a QMP Server it will report a restart. libvirtd uses QMP to manage qemu guests, so you might try setting something like a proxy qmp server up to look for reboot messages. http://wiki.qemu.org/QMP#Asynchronous_message has a little bit more, but the QEMU-KVM source code has the best documentation of events.

jbleners
  • 111
  • 2
  • Interesting, I wasn't familiar with QMP. In your answer are you referring to *reset* event documented at http://git.savannah.gnu.org/cgit/qemu.git/tree/QMP/qmp-events.txt ? Is this generated if the guest reboots itself (e.g someone logs in and issues the `reboot` command) or only if QEMU resets the quest (e.g. if a watchdog is set up and the timer expires). – sciurus May 15 '11 at 01:16
  • I believe it is sent when the guest issues a reboot via ACPI or other hardware method. There is a separate event type for watchdog events (see the very bottom of qmp-events.txt). – jbleners May 25 '11 at 22:53