When reboot using qemu guest agent was requested, qemu driver kept waiting for SHUTDOWN event from qemu. However, such event is never emitted during guest reboot and qemu driver would keep waiting forever. --- src/qemu/qemu_agent.c | 5 ++++- src/qemu/qemu_agent.h | 3 ++- src/qemu/qemu_process.c | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 51e60d2..804c424 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -1294,7 +1294,10 @@ int qemuAgentShutdown(qemuAgentPtr mon, if (!cmd) return -1; - mon->await_event = QEMU_AGENT_EVENT_SHUTDOWN; + if (mode == QEMU_AGENT_SHUTDOWN_REBOOT) + mon->await_event = QEMU_AGENT_EVENT_RESET; + else + mon->await_event = QEMU_AGENT_EVENT_SHUTDOWN; ret = qemuAgentCommand(mon, cmd, &reply, VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK); diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h index 528fee1..18740ba 100644 --- a/src/qemu/qemu_agent.h +++ b/src/qemu/qemu_agent.h @@ -55,7 +55,8 @@ void qemuAgentClose(qemuAgentPtr mon); typedef enum { QEMU_AGENT_EVENT_NONE = 0, QEMU_AGENT_EVENT_SHUTDOWN, - QEMU_AGENT_EVENT_SUSPEND + QEMU_AGENT_EVENT_SUSPEND, + QEMU_AGENT_EVENT_RESET, } qemuAgentEvent; void qemuAgentNotifyEvent(qemuAgentPtr mon, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 5c3b89e..93653c6 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -511,9 +511,15 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED, { struct qemud_driver *driver = qemu_driver; virDomainEventPtr event; + qemuDomainObjPrivatePtr priv; virDomainObjLock(vm); + event = virDomainEventRebootNewFromObj(vm); + priv = vm->privateData; + if (priv->agent) + qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_RESET); + virDomainObjUnlock(vm); if (event) { -- 1.7.12 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list