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

1 Answer 1

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.

2
  • Interesting, I wasn't familiar with QMP. In your answer are you referring to reset event documented at 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, 2011 at 1: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, 2011 at 22:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .