Message ID | d01002adb63ce555782a76d9dc506fa828b43fff.1452561712.git.crobinso@redhat.com |
---|---|
State | Accepted |
Commit | 8da02d528068942303923fc4f935e77cccac9c7c |
Headers | show |
On 01/12/2016 01:31 AM, Martin Kletzander wrote: > On Mon, Jan 11, 2016 at 08:22:33PM -0500, Cole Robinson wrote: >> When we autolaunch libvirtd for session URIs, we spin in a retry >> loop waiting for the daemon to start and the connect(2) to succeed. >> >> However if we exceed the retry count, we don't explicitly raise an >> error, which can yield a slew of different error messages elsewhere >> in the code. >> >> Explicitly raise the last connect(2) failure if we run out of retries. >> --- >> src/rpc/virnetsocket.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c >> index 80c21c1..2d6d44f 100644 >> --- a/src/rpc/virnetsocket.c >> +++ b/src/rpc/virnetsocket.c >> @@ -690,7 +690,9 @@ int virNetSocketNewConnectUNIX(const char *path, >> } >> VIR_DEBUG("connect() failed, errno=%d", errno); >> >> + retries--; >> if (!spawnDaemon || >> + retries == 0 || >> (errno != ENOENT && errno != ECONNREFUSED)) { >> virReportSystemError(errno, _("Failed to connect socket to '%s'"), >> path); > > Good catch, although I would also like to see the 'retries' being used > somewhere in a debug message, so that it is visible at least in the > debug logs why that happened. Good point, I squashed retries into the above VIR_DEBUG message, and pushed this series. Thanks for the review - Cole -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index 80c21c1..2d6d44f 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -690,7 +690,9 @@ int virNetSocketNewConnectUNIX(const char *path, } VIR_DEBUG("connect() failed, errno=%d", errno); + retries--; if (!spawnDaemon || + retries == 0 || (errno != ENOENT && errno != ECONNREFUSED)) { virReportSystemError(errno, _("Failed to connect socket to '%s'"), path); @@ -700,7 +702,6 @@ int virNetSocketNewConnectUNIX(const char *path, if (virNetSocketForkDaemon(binary) < 0) goto cleanup; - retries--; usleep(5000); }