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

Michal Privoznik mprivozn at redhat.com
Mon Nov 7 16:19:40 UTC 2016


On 03.11.2016 19:11, Maxim Nestratov wrote:
> 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,
> 

Huh, this event was never ever handled. How did we even manage that?

ACK

Michal




More information about the libvir-list mailing list