summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2010-10-04 08:11:27 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-04 07:18:18 -0700
commit14d6a7023fc1abc985675e9ee3e5fee4cd519210 (patch)
tree4ad2fb7938ffd3ef2ac8d4b7b72a95274ed83efe /xlators/mgmt
parentef0c7384299e6104a2d4a967847b8c9cea1e79b8 (diff)
implement volume level address allow/reject setting
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')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c44
1 files changed, 33 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 53250cc3e..3a85be50d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -107,8 +107,8 @@ static struct volopt_map_entry glusterd_volopt_map[] = {
{"ping-timeout", "protocol/client"},
{"inode-lru-limit", "protocol/server"},
- {"auth.addr.*.allow", "protocol/server"},
- {"auth.addr.*.reject", "protocol/server"},
+ {"allow", "protocol/server:!server-auth"},
+ {"reject", "protocol/server:!server-auth"},
{"write-behind", "performance/write-behind:!perf"},
{"read-ahead", "performance/read-ahead:!perf"},
@@ -130,6 +130,7 @@ struct volopt_map_entry2 {
};
static struct volopt_map_entry2 default_volopt_map2[] = {
+ {"allow", NULL, NULL, "*"},
{"write-behind", NULL, NULL, "on"},
{"read-ahead", NULL, NULL, "on"},
{"io-cache", NULL, NULL, "on"},
@@ -649,6 +650,34 @@ 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)
+{
+ xlator_t *xl = NULL;
+ xlator_list_t *trav = NULL;
+ char *aa = NULL;
+ int ret = 0;
+
+ if (strcmp (vme2->option, "!server-auth") != 0)
+ return 0;
+
+ xl = first_of (graph);
+
+ for (trav = xl->children; trav; trav = trav->next) {
+ ret = gf_asprintf (&aa, "auth.addr.%s.%s", trav->xlator->name,
+ vme2->key);
+ if (ret != -1) {
+ ret = xlator_set_option (xl, aa, vme2->value);
+ GF_FREE (aa);
+ }
+ if (ret)
+ return -1;
+ }
+
+ return 0;
+}
+
+static int
server_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo,
dict_t *set_dict, void *param)
{
@@ -658,7 +687,6 @@ server_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo,
xlator_t *xl = NULL;
xlator_t *txl = NULL;
xlator_t *rbxl = NULL;
- char *aaa = NULL;
int ret = 0;
char transt[16] = {0,};
@@ -731,14 +759,8 @@ server_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo,
if (ret)
return -1;
- ret = gf_asprintf (&aaa, "auth.addr.%s.allow", path);
- if (ret == -1) {
- gf_log ("", GF_LOG_ERROR, "Out of memory");
-
- return -1;
- }
- 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;
}