qemu: Fix reboot with guest agent

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.
This commit is contained in:
Jiri Denemark 2012-09-04 12:01:43 +02:00
parent 8675406cea
commit 03c42a4510
3 changed files with 12 additions and 2 deletions

View File

@ -1294,6 +1294,9 @@ int qemuAgentShutdown(qemuAgentPtr mon,
if (!cmd)
return -1;
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);

View File

@ -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,

View File

@ -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) {