summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorNithin D <nithind1988@yahoo.in>2016-02-28 21:45:48 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-03-21 10:52:50 -0700
commitb33f3c95ec9c8112e6677e09cea05c4c462040d0 (patch)
tree969d994858a49fc3d2fa32ff68b5e71909045918 /xlators
parent3e5445ae7d1dbbcc138374b6d2e5f95ffc556f4b (diff)
glusterd: Bug fixes for IPv6 support
Backport of http://review.gluster.org/#/c/11988/ Problem: Glusterd not working using ipv6 transport. The idea is with proper glusterd.vol configuration, 1. glusterd needs to listen on default port (240007) as IPv6 TCP listner. 2. Volume creation/deletion/mounting/add-bricks/delete-bricks/peer-probe needs to work using ipv6 addresses. 3. Bricks needs to listen on ipv6 addresses. All the above functionality is needed to say that glusterd supports ipv6 transport and this is broken. Fix: When "option transport.address-family inet6" option is present in glusterd.vol file, it is made sure that glusterd creates listeners using ipv6 sockets only and also the same information is saved inside brick volume files used by glusterfsd brick process when they are starting. Tests Run: Regression tests using ./run-tests.sh IPv4: Regression tests using ./run-tests.sh for release-3.7 branch verified by comparing with clean repo. IPv6: (Need to add the above mentioned config and also add an entry for "hostname ::1" in /etc/hosts) Started failing at ./tests/basic/glusterd/arbiter-volume-probe.t and ran successfully till here Change-Id: Idd7513aa2347ce0de2b1f68daeecce1b7a39a7af BUG: 1310445 Signed-off-by: Nithin D <nithind1988@yahoo.in> Reviewed-on: http://review.gluster.org/13787 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c15
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c38
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c42
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c6
-rwxr-xr-xxlators/mount/fuse/utils/mount.glusterfs.in3
-rwxr-xr-xxlators/mount/fuse/utils/mount_glusterfs.in3
6 files changed, 103 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index f1c3637270b..a3620bd33b3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -266,6 +266,7 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
xlator_t *this = NULL;
gf_boolean_t is_force = _gf_false;
gsync_status_param_t param = {0,};
+ char *c = NULL;
this = THIS;
GF_ASSERT (this);
@@ -417,8 +418,18 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
GD_MSG_NO_MEMORY, "Memory allocation failed");
goto out;
}
- host = strtok_r (dup_dstbrick, ":", &savetok);
- path = strtok_r (NULL, ":", &savetok);
+
+ /*
+ * IPv4 address contains '.' and ipv6 addresses contains ':'
+ * So finding the last occurance of ':' to
+ * mark the start of brick path
+ */
+ c = strrchr(dup_dstbrick, ':');
+ if (c != NULL) {
+ c[0] = '\0';
+ host = dup_dstbrick;
+ path = c++;
+ }
if (!host || !path) {
gf_msg (this->name, GF_LOG_ERROR, 0,
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 8a86ab53977..f1d9217be59 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -2086,6 +2086,7 @@ brick_graph_add_server (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char key[1024] = {0};
char *ssl_user = NULL;
char *value = NULL;
+ char *address_family_data = NULL;
if (!graph || !volinfo || !set_dict || !brickinfo)
goto out;
@@ -2122,6 +2123,17 @@ brick_graph_add_server (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
RPC_SET_OPT(xl, SSL_DH_PARAM_OPT, "ssl-dh-param", return -1);
RPC_SET_OPT(xl, SSL_EC_CURVE_OPT, "ssl-ec-curve", return -1);
+ if (dict_get_str (volinfo->dict, "transport.address-family",
+ &address_family_data) == 0) {
+ ret = xlator_set_option (xl, "transport.address-family",
+ address_family_data);
+ if (ret) {
+ gf_log ("glusterd", GF_LOG_WARNING,
+ "failed to set transport.address-family");
+ return -1;
+ }
+ }
+
if (username) {
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "auth.login.%s.allow",
@@ -2169,6 +2181,7 @@ brick_graph_add_pump (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char *password = NULL;
char *ptranst = NULL;
char *value = NULL;
+ char *address_family_data = NULL;
if (!graph || !volinfo || !set_dict)
@@ -2230,6 +2243,18 @@ brick_graph_add_pump (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (ret)
return -1;
+ if (dict_get_str (volinfo->dict, "transport.address-family",
+ &address_family_data) == 0) {
+ ret = xlator_set_option (rbxl,
+ "transport.address-family",
+ address_family_data);
+ if (ret) {
+ gf_log ("glusterd", GF_LOG_WARNING,
+ "failed to set transport.address-family");
+ return -1;
+ }
+ }
+
xl = volgen_graph_add_nolink (graph, "cluster/pump", "%s-pump",
volinfo->volname);
if (!xl)
@@ -2706,6 +2731,7 @@ volgen_graph_build_client (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char *ssl_str = NULL;
gf_boolean_t ssl_bool = _gf_false;
char *value = NULL;
+ char *address_family_data = NULL;
GF_ASSERT (graph);
GF_ASSERT (subvol);
@@ -2735,6 +2761,18 @@ volgen_graph_build_client (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (ret)
goto err;
+ if (dict_get_str (volinfo->dict, "transport.address-family",
+ &address_family_data) == 0) {
+ ret = xlator_set_option (xl,
+ "transport.address-family",
+ address_family_data);
+ if (ret) {
+ gf_log ("glusterd", GF_LOG_WARNING,
+ "failed to set transport.address-family");
+ goto err;
+ }
+ }
+
ret = dict_get_uint32 (set_dict, "trusted-client",
&client_type);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 8fd24f943ba..1c354493244 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -285,6 +285,7 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req)
xlator_t *this = NULL;
char *free_ptr = NULL;
char *trans_type = NULL;
+ char *address_family_str = NULL;
uuid_t volume_id = {0,};
uuid_t tmp_uuid = {0};
int32_t type = 0;
@@ -365,6 +366,8 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req)
goto out;
}
+
+
ret = dict_get_str (dict, "transport", &trans_type);
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get "
@@ -373,6 +376,30 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req)
GD_MSG_DICT_GET_FAILED, "%s", err_str);
goto out;
}
+
+ ret = dict_get_str (this->options, "transport.address-family",
+ &address_family_str);
+
+ if (!ret) {
+ ret = dict_set_dynstr_with_alloc (dict,
+ "transport.address-family",
+ address_family_str);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "failed to set transport.address-family");
+ goto out;
+ }
+ } else if (!strcmp(trans_type, "tcp")) {
+ /* Setting default as inet for trans_type tcp */
+ ret = dict_set_dynstr_with_alloc (dict,
+ "transport.address-family",
+ "inet");
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "failed to set transport.address-family");
+ goto out;
+ }
+ }
ret = dict_get_str (dict, "bricks", &bricks);
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get bricks for "
@@ -2089,6 +2116,7 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
char msg[1024] __attribute__((unused)) = {0, };
char *brick_mount_dir = NULL;
char key[PATH_MAX] = "";
+ char *address_family_str = NULL;
this = THIS;
GF_ASSERT (this);
@@ -2361,6 +2389,20 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
goto out;
}
+ ret = dict_get_str (dict, "transport.address-family",
+ &address_family_str);
+
+ if (!ret) {
+ ret = dict_set_dynstr_with_alloc(volinfo->dict,
+ "transport.address-family", address_family_str);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to set transport.address-family for %s",
+ volinfo->volname);
+ goto out;
+ }
+ }
+
gd_update_volume_op_versions (volinfo);
volinfo->caps = caps;
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index bbfe2d387d2..126913af548 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -1624,6 +1624,12 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.option = "!ssl-ec-curve",
.op_version = GD_OP_VERSION_3_7_4,
},
+ { .key = "transport.address-family",
+ .voltype = "protocol/server",
+ .option = "!address-family",
+ .op_version = GD_OP_VERSION_3_7_4,
+ .type = NO_DOC,
+ },
/* Performance xlators enable/disbable options */
{ .key = "performance.write-behind",
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in
index 7f314da69ec..b0af1af7e9d 100755
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
@@ -595,7 +595,8 @@ main ()
fi
[ -r "$volfile_loc" ] || {
- server_ip=$(echo "$volfile_loc" | sed -n 's/\([a-zA-Z0-9:.\-]*\):.*/\1/p');
+ # '%' included to support ipv6 link local addresses
+ server_ip=$(echo "$volfile_loc" | sed -n 's/\([a-zA-Z0-9:%.\-]*\):.*/\1/p');
volume_str=$(echo "$volfile_loc" | sed -n 's/.*:\([^ ]*\).*/\1/p');
[ -n "$volume_str" ] && {
volume_id="$volume_str";
diff --git a/xlators/mount/fuse/utils/mount_glusterfs.in b/xlators/mount/fuse/utils/mount_glusterfs.in
index 3d58c29e0cf..eca84557e87 100755
--- a/xlators/mount/fuse/utils/mount_glusterfs.in
+++ b/xlators/mount/fuse/utils/mount_glusterfs.in
@@ -501,7 +501,8 @@ main ()
done
[ -r "$volfile_loc" ] || {
- server_ip=$(echo "$volfile_loc" | sed -n 's/\([a-zA-Z0-9:.\-]*\):.*/\1/p');
+ # '%' included to support ipv6 link local addresses
+ server_ip=$(echo "$volfile_loc" | sed -n 's/\([a-zA-Z0-9:%.\-]*\):.*/\1/p');
volume_str=$(echo "$volfile_loc" | sed -n 's/.*:\([^ ]*\).*/\1/p');
[ -n "$volume_str" ] && {
volume_id="$volume_str";