[libvirt] [PATCH] rpc: ensure daemon is spawn even if dead socket exists

Martin Kletzander mkletzan at redhat.com
Wed Jul 8 08:51:54 UTC 2015


On Fri, Jul 03, 2015 at 04:54:20PM +0100, Daniel P. Berrange wrote:
>The auto-spawn code would originally attempt to spawn the
>daemon for both ENOENT and ECONNREFUSED errors from connect().
>The various refactorings eventually lost this so we only
>spawn the daemon on ENOENT. The result is if the daemon exits
>uncleanly, so that the socket is left in the filesystem, we
>will never be able to auto-spawn the daemon again.
>---
> src/rpc/virnetsocket.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>

ACK

>diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
>index 3d75081..106d09a 100644
>--- a/src/rpc/virnetsocket.c
>+++ b/src/rpc/virnetsocket.c
>@@ -681,7 +681,8 @@ int virNetSocketNewConnectUNIX(const char *path,
>
>     while (retries &&
>            connect(fd, &remoteAddr.data.sa, remoteAddr.len) < 0) {
>-        if (!(spawnDaemon && errno == ENOENT)) {
>+        if (!(spawnDaemon && (errno == ENOENT ||
>+                              errno == ECONNREFUSED))) {
>             virReportSystemError(errno, _("Failed to connect socket to '%s'"),
>                                  path);
>             goto cleanup;
>--
>2.4.3
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150708/00b250f1/attachment-0001.sig>


More information about the libvir-list mailing list