mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
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:
parent
8675406cea
commit
03c42a4510
@ -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);
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user