summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2019-10-24 12:24:35 +0530
committerRinku Kothiya <rkothiya@redhat.com>2020-02-10 07:31:40 +0000
commitf4f24c8c782bf4fa601f7ef14bbf2e2b6583cd90 (patch)
tree59ee628892fd955c7c0c18b81017dec4b86b6088
parenteff98516684b4d488e785e8d1b06f2876849f551 (diff)
gf-event: Handle unix volfile-servers
Problem: glfsheal program uses unix-socket-based volfile server. volfile server will be the path to socket in this case. gf_event expects this to be hostname in all cases. So getaddrinfo will fail on the unix-socket path, events won't be sent in this case. Fix: In case of unix sockets, default to localhost fixes: bz#1793085 Change-Id: I60d27608792c29d83fb82beb5fde5ef4754bece8 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
-rw-r--r--libglusterfs/src/events.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libglusterfs/src/events.c b/libglusterfs/src/events.c
index 25097675a9e..11b4c54c4d7 100644
--- a/libglusterfs/src/events.c
+++ b/libglusterfs/src/events.c
@@ -42,6 +42,7 @@ _gf_event(eventtypes_t event, const char *fmt, ...)
struct addrinfo hints;
struct addrinfo *result = NULL;
xlator_t *this = THIS;
+ char *volfile_server_transport = NULL;
/* Global context */
ctx = THIS->ctx;
@@ -61,8 +62,16 @@ _gf_event(eventtypes_t event, const char *fmt, ...)
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
+ if (ctx) {
+ volfile_server_transport = ctx->cmd_args.volfile_server_transport;
+ }
+
+ if (!volfile_server_transport) {
+ volfile_server_transport = "tcp";
+ }
/* Get Host name to send message */
- if (ctx && ctx->cmd_args.volfile_server) {
+ if (ctx && ctx->cmd_args.volfile_server &&
+ (strcmp(volfile_server_transport, "unix"))) {
/* If it is client code then volfile_server is set
use that information to push the events. */
if ((getaddrinfo(ctx->cmd_args.volfile_server, NULL, &hints,