diff options
author | Emmanuel Dreyfus <manu@netbsd.org> | 2011-08-12 16:20:14 +0200 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-08-16 21:38:08 -0700 |
commit | 02f45250af3fcb58a309e4089b64e2b147b1b265 (patch) | |
tree | e913063a9ba8436b488ce69ff5fae37aa6629f6f | |
parent | 023969d911b90420bd1733bae57d04e24dee5eda (diff) |
Make sure glusterd and glusterfsd use the same address family
NB: This was heavily tested on 3.2.2, but code has changed a lot
in the area. This patch itself is untested.
Change-Id: Ie472f04b0804276c2d8a9efc5c96106c33029498
BUG: 3422
Reviewed-on: http://review.gluster.com/229
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@gluster.com>
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 1cdb0faa4..b3d2946d7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -91,6 +91,50 @@ glusterd_unset_lock_owner (uuid_t owner) return 0; } +static const char * +glusterd_listener_family_name(void) +{ + xlator_t *this = NULL; + glusterd_conf_t *conf = NULL; + rpcsvc_listener_t *listener = NULL; + struct sockaddr_storage ss; + + this = THIS; + GF_ASSERT (this); + conf = this->private; + GF_ASSERT (conf); + GF_ASSERT (conf->rpc); + + list_for_each_entry (listener, &conf->rpc->listeners, list) + break; /* grab first one */ + + GF_ASSERT (listener->trans); + + if (rpc_transport_get_myaddr(listener->trans, NULL, 0, + &ss, sizeof(ss)) != 0) { + gf_log ("glusterd", GF_LOG_ERROR, + "rpc_transport_get_myname failed: %s", + strerror(errno)); + return NULL; + } + + switch (ss.ss_family) { + case AF_INET: + return "inet"; + break; + case AF_INET6: + return "inet6"; + break; + default: + gf_log ("glusterd", GF_LOG_ERROR, + "unknown address family %d", + ss.ss_family); + break; + } + + return NULL; +} + gf_boolean_t glusterd_is_loopback_localhost (const struct sockaddr *sa, char *hostname) { @@ -1029,6 +1073,7 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo, FILE *file = NULL; gf_boolean_t is_locked = _gf_false; char socketpath[PATH_MAX] = {0}; + const char *family_name; GF_ASSERT (volinfo); GF_ASSERT (brickinfo); @@ -1116,6 +1161,13 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo, "--brick-name", brickinfo->path, "-l", brickinfo->logfile, "--brick-port", NULL); + if ((family_name = glusterd_listener_family_name()) != NULL) { + runner_add_arg (&runner, "--xlator-option"); + runner_argprintf (&runner, + "%s-server.transport.address-family=%s", + volinfo->volname, family_name); + } + if (volinfo->transport_type != GF_TRANSPORT_BOTH_TCP_RDMA) { runner_argprintf (&runner, "%d", port); } else { |