[libvirt] [PATCH] qemu: fix one reboot scenario

Maxim Nestratov mnestratov at virtuozzo.com
Thu Nov 3 18:11:00 UTC 2016


Both qemuDomainReboot and qemuDomainShutdownFlags do the following if
they were called to reboot:
1. use agent and call qemuAgentShutdown
2. then if the above function doesn't succeed, try qemuMonitorSystemPowerdown

When the first step is called, it resets fakeReboot flag, while the second one,
opposite to that, sets it. Thus, in case we tried to use agent to reboot a
guest and failed for some reason, we end up with fakeReboot flag set. After that,
as qemuMonitorSystemPowerdown function was called, libvirt is notified with POWERDOWN.
The problem is that there is no callback routine set for it. The lack of monitor event
reaction leads to incorrect logic and guest doesn't restart or reboot correctly.
The patch simply sets domainPowerdown monitor callback to qemuProcessHandleShutdown as
powerdown event processing is actually equal to shutdown.

Signed-off-by: Maxim Nestratov <mnestratov at virtuozzo.com>
---
 src/qemu/qemu_process.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 04b25fe..0de9fa5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1630,6 +1630,7 @@ static qemuMonitorCallbacks monitorCallbacks = {
     .diskSecretLookup = qemuProcessFindVolumeQcowPassphrase,
     .domainEvent = qemuProcessHandleEvent,
     .domainShutdown = qemuProcessHandleShutdown,
+    .domainPowerdown = qemuProcessHandleShutdown,
     .domainStop = qemuProcessHandleStop,
     .domainResume = qemuProcessHandleResume,
     .domainReset = qemuProcessHandleReset,
-- 
2.4.11




More information about the libvir-list mailing list