[libvirt] [PATCH] qemu: fix monitor socket reconnection

Hi, This patch fixes a handling of a qemu monitor unix socket. Current code addresses 'Socket may not have shown up yet' case with catching EACCES of connect(2), however, in that case, an errno which should be catched is ENOENT, not EACCES. Thanks, ozaki-r
From 5a4b7ee2296ca6756127c26c6bfbbe1f49ab8722 Mon Sep 17 00:00:00 2001 From: Ryota Ozaki <ozaki.ryota@gmail.com> Date: Tue, 28 Jul 2009 23:48:22 +0900 Subject: [PATCH] qemu: fix monitor socket reconnection
--- src/qemu_driver.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 52a77be..9fb8506 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -917,8 +917,8 @@ qemudOpenMonitorUnix(virConnectPtr conn, if (ret == 0) break; - if (errno == EACCES || errno == ECONNREFUSED) { - /* EACCES : Socket may not have shown up yet + if (errno == ENOENT || errno == ECONNREFUSED) { + /* ENOENT : Socket may not have shown up yet * ECONNREFUSED : Leftover socket hasn't been removed yet */ continue; } -- 1.6.0.6

On Wed, Jul 29, 2009 at 12:09:44AM +0900, Ryota Ozaki wrote:
Hi,
This patch fixes a handling of a qemu monitor unix socket. Current code addresses 'Socket may not have shown up yet' case with catching EACCES of connect(2), however, in that case, an errno which should be catched is ENOENT, not EACCES.
Thanks, ozaki-r
From 5a4b7ee2296ca6756127c26c6bfbbe1f49ab8722 Mon Sep 17 00:00:00 2001 From: Ryota Ozaki <ozaki.ryota@gmail.com> Date: Tue, 28 Jul 2009 23:48:22 +0900 Subject: [PATCH] qemu: fix monitor socket reconnection
--- src/qemu_driver.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 52a77be..9fb8506 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -917,8 +917,8 @@ qemudOpenMonitorUnix(virConnectPtr conn, if (ret == 0) break;
- if (errno == EACCES || errno == ECONNREFUSED) { - /* EACCES : Socket may not have shown up yet + if (errno == ENOENT || errno == ECONNREFUSED) { + /* ENOENT : Socket may not have shown up yet * ECONNREFUSED : Leftover socket hasn't been removed yet */ continue; }
ACK, that existing code is clearly bogus Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On 07/29/2009 08:35 AM, Daniel P. Berrange wrote:
On Wed, Jul 29, 2009 at 12:09:44AM +0900, Ryota Ozaki wrote:
Hi,
This patch fixes a handling of a qemu monitor unix socket. Current code addresses 'Socket may not have shown up yet' case with catching EACCES of connect(2), however, in that case, an errno which should be catched is ENOENT, not EACCES.
Thanks, ozaki-r
From 5a4b7ee2296ca6756127c26c6bfbbe1f49ab8722 Mon Sep 17 00:00:00 2001 From: Ryota Ozaki <ozaki.ryota@gmail.com> Date: Tue, 28 Jul 2009 23:48:22 +0900 Subject: [PATCH] qemu: fix monitor socket reconnection
--- src/qemu_driver.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 52a77be..9fb8506 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -917,8 +917,8 @@ qemudOpenMonitorUnix(virConnectPtr conn, if (ret == 0) break;
- if (errno == EACCES || errno == ECONNREFUSED) { - /* EACCES : Socket may not have shown up yet + if (errno == ENOENT || errno == ECONNREFUSED) { + /* ENOENT : Socket may not have shown up yet * ECONNREFUSED : Leftover socket hasn't been removed yet */ continue; }
ACK, that existing code is clearly bogus
Hmm, I thoroughly tested this for both of those issues listed in the comments, and the original code seemed to do the job. But it certainly appears to be bogus. I'll try to reproduce the original issue and make sure this code works as expected. - Cole

On Wed, Jul 29, 2009 at 11:49 PM, Cole Robinson<crobinso@redhat.com> wrote:
On 07/29/2009 08:35 AM, Daniel P. Berrange wrote:
On Wed, Jul 29, 2009 at 12:09:44AM +0900, Ryota Ozaki wrote:
Hi,
This patch fixes a handling of a qemu monitor unix socket. Current code addresses 'Socket may not have shown up yet' case with catching EACCES of connect(2), however, in that case, an errno which should be catched is ENOENT, not EACCES.
Thanks, ozaki-r
From 5a4b7ee2296ca6756127c26c6bfbbe1f49ab8722 Mon Sep 17 00:00:00 2001 From: Ryota Ozaki <ozaki.ryota@gmail.com> Date: Tue, 28 Jul 2009 23:48:22 +0900 Subject: [PATCH] qemu: fix monitor socket reconnection
--- src/qemu_driver.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 52a77be..9fb8506 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -917,8 +917,8 @@ qemudOpenMonitorUnix(virConnectPtr conn, if (ret == 0) break;
- if (errno == EACCES || errno == ECONNREFUSED) { - /* EACCES : Socket may not have shown up yet + if (errno == ENOENT || errno == ECONNREFUSED) { + /* ENOENT : Socket may not have shown up yet * ECONNREFUSED : Leftover socket hasn't been removed yet */ continue; }
ACK, that existing code is clearly bogus
Hmm, I thoroughly tested this for both of those issues listed in the comments, and the original code seemed to do the job. But it certainly appears to be bogus.
I'll try to reproduce the original issue and make sure this code works as expected.
The bug might appear depending on the underlying environment then I describe my testing environment. - libvirt-0.7.0-0.1.gitf055724 - qemu-kvm-0.10.5 - kernel-2.6.31-rc3 I hope this could be of help, ozaki-r
- Cole

On Wed, Jul 29, 2009 at 12:09:44AM +0900, Ryota Ozaki wrote:
Hi,
This patch fixes a handling of a qemu monitor unix socket. Current code addresses 'Socket may not have shown up yet' case with catching EACCES of connect(2), however, in that case, an errno which should be catched is ENOENT, not EACCES.
Okay, makes sense, applied and commited. As suggested I will probably make a new intermediate release with that fix ! thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (4)
-
Cole Robinson
-
Daniel P. Berrange
-
Daniel Veillard
-
Ryota Ozaki