From 232482637171142b3a9da19bf91403fc63b19b10 Mon Sep 17 00:00:00 2001 From: Ashish Pandey Date: Mon, 11 Apr 2016 17:31:58 +0530 Subject: performance/decompounder: Add graph for decompounder xlator This xlator will fall below protocol/server. This is mandatory xlator without any options. Observed that the callback for decompounder translator was not added which was causing volume start to fail. Added cbks for decompounder. master- http://review.gluster.org/#/c/13968/ Change-Id: I3e16a566376338d9c6d36d6fbc7bf295fda9f3a6 BUG: 1346222 Signed-off-by: Ashish Pandey Reviewed-on: http://review.gluster.org/14729 Reviewed-by: Ravishankar N Smoke: Gluster Build System Reviewed-by: Anuradha Talur CentOS-regression: Gluster Build System Reviewed-by: Niels de Vos NetBSD-regression: NetBSD Build System --- xlators/mgmt/glusterd/src/glusterd-volgen.c | 59 ++++++++++++++++++---- .../performance/decompounder/src/decompounder.c | 6 +++ 2 files changed, 56 insertions(+), 9 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index fe7c3405ed3..ac9a4def054 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1164,6 +1164,7 @@ server_auth_option_handler (volgen_graph_t *graph, char *aa = NULL; int ret = 0; char *key = NULL; + char *auth_path = NULL; if (strcmp (vme->option, "!server-auth") != 0) return 0; @@ -1173,16 +1174,21 @@ server_auth_option_handler (volgen_graph_t *graph, /* from 'auth.allow' -> 'allow', and 'auth.reject' -> 'reject' */ key = strchr (vme->key, '.') + 1; - for (trav = xl->children; trav; trav = trav->next) { - ret = gf_asprintf (&aa, "auth.addr.%s.%s", trav->xlator->name, + ret = xlator_get_option (xl, "auth-path", &auth_path); + if (ret) { + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DEFAULT_OPT_INFO, + "Failed to get auth-path from server graph"); + return -1; + } + ret = gf_asprintf (&aa, "auth.addr.%s.%s", auth_path, key); - if (ret != -1) { - ret = xlator_set_option (xl, aa, vme->value); - GF_FREE (aa); - } - if (ret) - return -1; + if (ret != -1) { + ret = xlator_set_option (xl, aa, vme->value); + GF_FREE (aa); } + if (ret) + return -1; return 0; } @@ -1522,6 +1528,27 @@ out: return ret; } +static int +brick_graph_add_decompounder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, + dict_t *set_dict, glusterd_brickinfo_t *brickinfo) +{ + xlator_t *xl = NULL; + xlator_t *this = NULL; + glusterd_conf_t *conf = NULL; + int ret = -1; + + this = THIS; + GF_VALIDATE_OR_GOTO ("glusterd", this, out); + conf = this->private; + GF_VALIDATE_OR_GOTO (this->name, conf, out); + + xl = volgen_graph_add (graph, "performance/decompounder", volinfo->volname); + if (xl) + ret = 0; +out: + return ret; +} + static int brick_graph_add_arbiter (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, dict_t *set_dict, glusterd_brickinfo_t *brickinfo) @@ -2165,6 +2192,13 @@ brick_graph_add_server (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, return -1; } + memset (key, 0, sizeof (key)); + snprintf (key, sizeof (key), "auth-path"); + + ret = xlator_set_option (xl, key, brickinfo->path); + if (ret) + return -1; + if (dict_get_str (volinfo->dict, "auth.ssl-allow", &ssl_user) == 0) { memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "auth.login.%s.ssl-allow", @@ -2287,7 +2321,8 @@ out: * the topology of the brick graph */ static volgen_brick_xlator_t server_graph_table[] = { {brick_graph_add_server, NULL}, - {brick_graph_add_io_stats, NULL}, + {brick_graph_add_decompounder, "decompounder"}, + {brick_graph_add_io_stats, "NULL"}, {brick_graph_add_cdc, NULL}, {brick_graph_add_quota, "quota"}, {brick_graph_add_index, "index"}, @@ -5392,6 +5427,7 @@ glusterd_snapdsvc_generate_volfile (volgen_graph_t *graph, char *loglevel = NULL; char *xlator = NULL; char *value = NULL; + char auth_path[] = "auth-path"; set_dict = dict_copy (volinfo->dict, NULL); if (!set_dict) @@ -5459,6 +5495,11 @@ glusterd_snapdsvc_generate_volfile (volgen_graph_t *graph, if (ret) return -1; + snprintf (key, sizeof (key), "snapd-%s", volinfo->volname); + ret = xlator_set_option (xl, auth_path, key); + if (ret) + return -1; + ret = volgen_graph_set_options_generic (graph, set_dict, (xlator && loglevel)? (void *)set_dict: volinfo, diff --git a/xlators/performance/decompounder/src/decompounder.c b/xlators/performance/decompounder/src/decompounder.c index 830876ec0bf..3009fcdd4b1 100644 --- a/xlators/performance/decompounder/src/decompounder.c +++ b/xlators/performance/decompounder/src/decompounder.c @@ -899,6 +899,12 @@ out: return 0; } +struct xlator_cbks cbks = { +}; + +struct volume_options options[] = { +}; + struct xlator_fops fops = { .compound = dc_compound, }; -- cgit