[libvirt] [PATCH] virDomainShutdown*: Describe blocking behaviour

Michal Privoznik mprivozn at redhat.com
Tue Mar 31 07:37:01 UTC 2015


On 30.03.2015 22:38, Eric Blake wrote:
> On 03/30/2015 06:07 AM, Michal Privoznik wrote:
>> The description to both virDomainShutdown() and
>> virDomainShutdownFlags() is quite misleading when it comes to
>> blocking behaviour of these two APIs. Firstly, we support many
>> shutdown methods, from signalizing an ACPI event, through sending
>> a signal to guest agent assisted shutdown. Some of these methods
>> make the API return immediately, while others block the API until
>> domain is actually shut of. And since virDomainShutdown() is
> 
> s/of/off/
> 
>> equivalent to calling virDomainShutdownFlags(0), it's up to each
>> driver which methods to try. So the bare virDomainShutdown() may
>> block or may return immediately at the same time. I know, it's
>> confusing, but at least let users know.
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>>  src/libvirt-domain.c | 13 +++++++++----
>>  1 file changed, 9 insertions(+), 4 deletions(-)
>>
> 
> I don't think this is the right approach.  It is okay to block for a
> small finite amount of time, but if the guest agent really is something
> that can hang, we should fix that code to return without waiting for the
> agent response.
>

The problem is, we can tell if the shutdown qemu-ga command succeeded
only when we see the SHUTDOWN event on the domain monitor. The other
option is to treat it like we're treating ACPI mode of the API: just
send the request and report if the sending succeeded. Don't wait until
domain actually shuts down. I can provide a patch.

Michal




More information about the libvir-list mailing list