diff options
author | Kevin Vigor <kvigor@fb.com> | 2016-12-21 09:27:36 -0800 |
---|---|---|
committer | Kevin Vigor <kvigor@fb.com> | 2016-12-21 10:58:54 -0800 |
commit | 9e1e0bf6e025c5fbd463086b47de18652fa3eb2f (patch) | |
tree | c4d390bf89216340af090ba69173bdc8edfd92db /rpc/rpc-lib/src | |
parent | 11afb5954e43848f5cf5ba7eac0f7ad8ef233934 (diff) |
Repair cluster prove tests for FB environment
Summary:
Several prove tests use the 'launch_cluster' function to set up a
clustered volume. This replies on using multiple local IP
addresses, one for each server. Since IPV6 provides only ::1 as
a local address, as opposed to IPv4's complete 127.x.x.x subnet,
this cannot work in a pure IPv6 environment.
However, FB systems do at least have enough IPv4 stack to talk
locally, so fix launch_cluster to work properly when default
transport is IPv6.
To do this:
1) explicitly set transport.address-family volume option to inet in
launch_cluster().
2) teach glusterd to honor transport.address-family when connecting
to peer glusterds in glusterd_friend_rpc_create(). Previously
transport.address-family was used only for binding local socket,
not for communicating with peers.
Test Plan:
prove -f --timer ./tests/basic/glusterd/arbiter-volume-probe.t
Reviewers:
Subscribers:
Tasks:
Blame Revision:
Change-Id: I077d8549dcdbe4919ac7df34856a4b2d1428cdb6
Signed-off-by: Kevin Vigor <kvigor@fb.com>
Reviewed-on: http://review.gluster.org/16225
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Shreyas Siravara <sshreyas@fb.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'rpc/rpc-lib/src')
-rw-r--r-- | rpc/rpc-lib/src/rpc-transport.c | 23 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-transport.h | 3 |
2 files changed, 21 insertions, 5 deletions
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c index 1bae2eddfca..5556740ca81 100644 --- a/rpc/rpc-lib/src/rpc-transport.c +++ b/rpc/rpc-lib/src/rpc-transport.c @@ -665,23 +665,37 @@ out: return ret; } +/** @brief build a dictionary containing basic transport options. + * + * @param[out] options: will be set to a newly created dictionary on success. + * @param[in] hostname: desired target hostname. + * @param[in] port: desired target port. + * @param[in] addr_family (optional): desired address family. If NULL, + * default will be used. + * + * @returns zero on success. + */ int rpc_transport_inet_options_build (dict_t **options, const char *hostname, - int port) + int port, const char *addr_family) { dict_t *dict = NULL; char *host = NULL; int ret = -1; #ifdef IPV6_DEFAULT - char *addr_family = "inet6"; + const char *addr_family_default = "inet6"; #else - char *addr_family = "inet"; + const char *addr_family_default = "inet"; #endif GF_ASSERT (options); GF_ASSERT (hostname); GF_ASSERT (port >= 1024); + if (!addr_family) { + addr_family = addr_family_default; + } + dict = dict_new (); if (!dict) goto out; @@ -706,7 +720,8 @@ rpc_transport_inet_options_build (dict_t **options, const char *hostname, goto out; } - ret = dict_set_str (dict, "address-family", addr_family); + ret = dict_set_str (dict, "transport.address-family", + (char *)addr_family); if (ret) { gf_log (THIS->name, GF_LOG_WARNING, "failed to set address-family to %s", addr_family); diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h index f0add065065..0f555462ea4 100644 --- a/rpc/rpc-lib/src/rpc-transport.h +++ b/rpc/rpc-lib/src/rpc-transport.h @@ -311,5 +311,6 @@ rpc_transport_unix_options_build (dict_t **options, char *filepath, int frame_timeout); int -rpc_transport_inet_options_build (dict_t **options, const char *hostname, int port); +rpc_transport_inet_options_build (dict_t **options, const char *hostname, + int port, const char *addr_family); #endif /* __RPC_TRANSPORT_H__ */ |