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(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org