[libvirt] [PATCH] qemu: Faster response time to qemu startup errors

Eric Blake eblake at redhat.com
Mon Jun 13 19:36:25 UTC 2011


On 06/13/2011 01:26 PM, Stefan Berger wrote:
> The below patch decreases the response time of libvirt to errors
> reported by Qemu upon startup by checking whether the qemu process is
> still alive while polling for the local socket to show up.
> 

> @@ -274,7 +274,8 @@ qemuMonitorOpenUnix(const char *monitor)
>          if (ret == 0)
>              break;
> 
> -        if (errno == ENOENT || errno == ECONNREFUSED) {
> +        if ((errno == ENOENT || errno == ECONNREFUSED) &&
> +            virKillProcess(cpid, 0) == 0) {
>              /* ENOENT       : Socket may not have shown up yet
>               * ECONNREFUSED : Leftover socket hasn't been removed yet */
>              continue;

Calling virKillProcess changes errno; in fact, errno will probably be
ESRCH if virKillProcess ended up being called but the process is not
alive.  But I guess that is just as good a message, and can only happen
on ENOENT or ECONNREFUSED in the first place, so it looks okay to me.

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110613/38178ad7/attachment-0001.sig>


More information about the libvir-list mailing list