summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2017-10-10 14:45:03 +0530
committerAtin Mukherjee <amukherj@redhat.com>2017-10-18 14:15:05 +0000
commit77271e9c1efab628d00bc66803be923f451c0bfa (patch)
tree4e4183568a2fdda702ae5cdcd4624a53fc39b1cf /xlators/mgmt/glusterd/src/glusterd-volgen.c
parente848410ab6d13871be6b57101788ea5183efe75c (diff)
gfproxyd: Let glusterd manage gfproxy daemon
Updates: #242 BUG: 1428063 Change-Id: Iaaf2edf99b2ecc75f6d30762c752a6d445c1c826 Signed-off-by: Poornima G <pgurusid@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c91
1 files changed, 40 insertions, 51 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 93b6e95..ac74c8a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -36,6 +36,7 @@
#include "glusterd-svc-mgmt.h"
#include "glusterd-svc-helper.h"
#include "glusterd-snapd-svc-helper.h"
+#include "glusterd-gfproxyd-svc-helper.h"
struct gd_validate_reconf_opts {
dict_t *options;
@@ -58,11 +59,6 @@ extern struct volopt_map_entry glusterd_volopt_map[];
} \
} while (0 /* CONSTCOND */)
-/**
- * Needed for GFProxy
- */
-#define GF_PROXY_DAEMON_PORT 40000
-#define GF_PROXY_DAEMON_PORT_STR "40000"
static int
volgen_graph_build_clients (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
@@ -1518,10 +1514,6 @@ gfproxy_server_graph_builder (volgen_graph_t *graph,
if (!xl)
goto out;
- ret = xlator_set_option (xl, "listen-port", GF_PROXY_DAEMON_PORT_STR);
- if (ret != 0)
- goto out;
-
ret = xlator_set_option (xl, "transport-type", transt);
if (ret != 0)
goto out;
@@ -1530,13 +1522,15 @@ gfproxy_server_graph_builder (volgen_graph_t *graph,
username = glusterd_auth_get_username (volinfo);
password = glusterd_auth_get_password (volinfo);
if (username) {
- snprintf (key, sizeof (key), "auth.login.%s-server.allow",
- volinfo->volname);
+ snprintf (key, sizeof (key),
+ "auth.login.gfproxyd-%s.allow",
+ volinfo->volname);
ret = xlator_set_option (xl, key, username);
if (ret)
return -1;
}
+ memset (key, 0, sizeof (key));
if (password) {
snprintf (key, sizeof (key), "auth.login.%s.password",
username);
@@ -1545,6 +1539,10 @@ gfproxy_server_graph_builder (volgen_graph_t *graph,
goto out;
}
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "gfproxyd-%s", volinfo->volname);
+ ret = xlator_set_option (xl, "auth-path", key);
+
out:
return ret;
}
@@ -4325,7 +4323,8 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
int uss_enabled = -1;
xlator_t *this = THIS;
char *subvol = NULL;
- size_t subvol_namelen = 0;
+ size_t namelen = 0;
+ char *xl_id = NULL;
GF_ASSERT (this);
GF_ASSERT (conf);
@@ -4351,20 +4350,17 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (ret == -1)
goto out;
} else {
- ret = dict_get_str (set_dict,
- "config.gfproxyd-remote-host", &tmp);
- if (ret == -1)
- goto out;
+ namelen = strlen (volinfo->volname) + strlen ("gfproxyd-") + 1;
+ subvol = alloca (namelen);
+ snprintf (subvol, namelen, "gfproxyd-%s", volinfo->volname);
- subvol_namelen = strlen (volinfo->volname) +
- strlen ("-server") + 1;
- subvol = alloca (subvol_namelen);
- snprintf (subvol, subvol_namelen,
- "%s-server", volinfo->volname);
-
- volgen_graph_build_client (graph, volinfo, tmp,
- GF_PROXY_DAEMON_PORT_STR, subvol,
- "gfproxy", "tcp", set_dict);
+ namelen = strlen (volinfo->volname) +
+ strlen ("-gfproxy-client") + 1;
+ xl_id = alloca (namelen);
+ snprintf (xl_id, namelen, "%s-gfproxy-client",
+ volinfo->volname);
+ volgen_graph_build_client (graph, volinfo, NULL, NULL,
+ subvol, xl_id, "tcp", set_dict);
}
ret = dict_get_str_boolean (set_dict, "features.shard", _gf_false);
@@ -5500,20 +5496,6 @@ get_brick_filepath (char *filename, glusterd_volinfo_t *volinfo,
brickinfo->hostname, brick);
}
-static void
-get_gfproxyd_filepath (char *filename, glusterd_volinfo_t *volinfo)
-{
- char path[PATH_MAX] = {0, };
- glusterd_conf_t *priv = NULL;
-
- priv = THIS->private;
-
- GLUSTERD_GET_VOLUME_DIR (path, volinfo, priv);
-
- snprintf (filename, PATH_MAX,
- "%s/%s.gfproxyd.vol", path,
- volinfo->volname);
-}
gf_boolean_t
glusterd_is_valid_volfpath (char *volname, char *brick)
@@ -5559,23 +5541,14 @@ out:
return ret;
}
-static int
-glusterd_generate_gfproxyd_volfile (glusterd_volinfo_t *volinfo)
+int
+glusterd_build_gfproxyd_volfile (glusterd_volinfo_t *volinfo, char *filename)
{
volgen_graph_t graph = {0, };
- char filename[PATH_MAX] = {0, };
int ret = -1;
- GF_ASSERT (volinfo);
-
- get_gfproxyd_filepath (filename, volinfo);
-
- struct glusterd_gfproxyd_info info = {
- .port = GF_PROXY_DAEMON_PORT,
- };
-
ret = build_graph_generic (&graph, volinfo,
- NULL, &info,
+ NULL, NULL,
&gfproxy_server_graph_builder);
if (ret == 0)
ret = volgen_write_volfile (&graph, filename);
@@ -5585,6 +5558,22 @@ glusterd_generate_gfproxyd_volfile (glusterd_volinfo_t *volinfo)
return ret;
}
+int
+glusterd_generate_gfproxyd_volfile (glusterd_volinfo_t *volinfo)
+{
+ char filename[PATH_MAX] = {0, };
+ int ret = -1;
+
+ GF_ASSERT (volinfo);
+
+ glusterd_svc_build_gfproxyd_volfile_path (volinfo, filename,
+ PATH_MAX - 1);
+
+ ret = glusterd_build_gfproxyd_volfile (volinfo, filename);
+
+ return ret;
+}
+
static int
glusterd_generate_brick_volfile (glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *brickinfo,