[libvirt] [PATCH 1/3] qemu: Wait for monitor socket even without pid
Daniel P. Berrange
berrange at redhat.com
Wed Nov 28 14:50:17 UTC 2012
On Mon, Nov 26, 2012 at 03:17:12PM +0100, Viktor Mihajlovski wrote:
> If qemuMonitorOpenUnix is called without a related pid, i.e. for
> QMP probing, a connect failure can happen as the result of a race.
> Without a pid there is no retry and thus we give up to early.
> This changes the code to retry if no pid is supplied.
>
> Signed-off-by: Viktor Mihajlovski <mihajlov at linux.vnet.ibm.com>
> ---
> src/qemu/qemu_monitor.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index cbde2b1..fe8424f 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -283,7 +283,7 @@ qemuMonitorOpenUnix(const char *monitor, pid_t cpid)
> break;
>
> if ((errno == ENOENT || errno == ECONNREFUSED) &&
> - cpid && virProcessKill(cpid, 0) == 0) {
> + (!cpid || virProcessKill(cpid, 0) == 0)) {
> /* ENOENT : Socket may not have shown up yet
> * ECONNREFUSED : Leftover socket hasn't been removed yet */
> continue;
> --
ACK
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list