[libvirt] [PATCH] qemu: Allow graceful domain destroy

Michal Privoznik mprivozn at redhat.com
Mon Aug 22 10:49:48 UTC 2011


On 22.08.2011 12:27, Daniel P. Berrange wrote:
> On Sat, Aug 20, 2011 at 01:06:10PM +0200, Michal Privoznik wrote:
>> This patch introduces support for domain destroying via 'quit' monitor
>> command which gives qemu time to flush caches and therefore prevent
>> disks corruption. However, qemu can be unresponsive and to prevent
>> waiting indefinitely, execute command in a separate thread and wait
>> reasonable time (QEMU_QUIT_WAIT_SECONDS) on a condition. If we hit
>> timeout, qemu is qemuProcessKill'ed which causes monitor close and
>> therefore also thread being terminable.
>>
>> The synchronization between qemu driver and monitor-quit thread is done
>> through mutex and condition. However, this alone is not enough. If a
>> condition is signalized but without anybody listening signal is lost. To
>> prevent this a boolean variable is used that is set iff nobody is
>> listening but condition would be signalized, or iff driver is waiting on
>> given condition.
> 
> If we want to talk to the monitor, then we can't do that in the
> virDomainDestroy API call.
> 
> Your previous patches add a separate high priority queue to
> libvirtd, for dispatch of RPC calls which do *not* use the monitor
> which we need to always be processed immediately. virDomainDestroy
> is one of those high priority calls. We can't do routing of the RPC
> call based on flag values for the API, therefore, we must *never* use
> the monitor from virDomainDestroy.
> 
> Regards,
> Daniel

I don't think that's problem. High priority calls must be guaranteed to
end in reasonably short time. And although we talk to monitor here, we
are guaranteed to end. Therefore no need to change my previous patch.

'Accessing monitor' is a bit unfortunate formulation, because 99% calls
which do access monitor can block indefinitely. And this is the real
problem. Stuck API. It doesn't really matter if it is because of
monitor, NFS, etc. I just wanted to provide guide for developers if they
are in doubt whether to mark API as high or low priority.

Michal




More information about the libvir-list mailing list