summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2010-10-02 18:44:15 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-02 22:19:10 -0700
commitff7f17da9e1817c6d02da3e98163fce834b429f6 (patch)
tree31decfdf72e8af760fcbd5ffd0bd79b7d36622b6 /xlators/mgmt/glusterd/src/glusterd-volgen.c
parente463cb64d99cf741fabf9e46f7511554607e250e (diff)
volgen: add support for auth.addr.%s.{allow, reject} options
Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1750 (clean up volgen) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1750
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 59f20a885ed..f83cdefe828 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -98,6 +98,8 @@ struct volopt_map_entry glusterd_volopt_map[] = {
{"ping-timeout", "protocol/client"},
{"inode-lru-limit", "protocol/server"},
+ {"auth.addr.%s.allow", "protocol/server:!server-auth"},
+ {"auth.addr.%s.reject", "protocol/server:!server-auth"},
{"write-behind", "performance/write-behind:!perf"},
{"read-ahead", "performance/read-ahead:!perf"},
@@ -525,6 +527,50 @@ get_vol_transport_type (glusterd_volinfo_t *volinfo, char *tt)
}
static int
+server_auth_option_handler (glusterfs_graph_t *graph,
+ struct volopt_map_entry2 *vme2, void *param)
+{
+ char *brick = NULL;
+ char *addrs = NULL;
+ char *opt = NULL;
+ int ret = 0;
+
+ if (strcmp (vme2->option, "!server-auth") != 0)
+ return 0;
+
+ brick = gf_strdup (vme2->value);
+ if (!brick) {
+ ret = -1;
+ goto out;
+ }
+ addrs = strchr (brick, ':');
+ if (!addrs || !addrs[1]) {
+ GF_FREE (brick);
+ return -1;
+ }
+ *addrs++ = '\0';
+ ret = gf_asprintf (&opt, vme2->key, brick);
+ if (ret == -1) {
+ opt = NULL;
+ goto out;
+ }
+ ret = xlator_set_option (first_of (graph), opt, addrs);
+
+ out:
+ if (brick)
+ GF_FREE (brick);
+ if (opt)
+ GF_FREE (opt);
+
+ if (ret == 0)
+ return 0;
+
+ gf_log ("", GF_LOG_ERROR, "Out of memory");
+
+ return -1;
+}
+
+static int
server_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo,
dict_t *set_dict, void *param)
{
@@ -616,6 +662,9 @@ server_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo,
ret = xlator_set_option (xl, aaa, "*");
GF_FREE (aaa);
+ ret = volgen_graph_set_options_generic (graph, set_dict, NULL,
+ &server_auth_option_handler);
+
return ret;
}