summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
authorVenky Shankar <venky@gluster.com>2011-09-13 11:36:55 +0530
committerVijay Bellur <vijay@gluster.com>2011-09-13 10:14:04 -0700
commitd705b28fd1bb066632854da493031118776d00df (patch)
treefa1e2710695b2c0ad6d9bc93d7b235922c634f7e /xlators/mgmt/glusterd/src
parentb039cb193eddc51c6f31bf9a230281faada475fe (diff)
GlusterFS Hadoop specific DSL for mountbroker
Change-Id: Ie379992bdea0974c8c5e1a4d7bc3e87cefe0d256 BUG: 3539 Reviewed-on: http://review.gluster.com/404 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mountbroker.c26
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mountbroker.h2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c49
3 files changed, 65 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
index 03767ee6de6..590a3f96848 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
@@ -277,6 +277,17 @@ const char *georep_mnt_desc_template =
"log-level=* "
")";
+const char *hadoop_mnt_desc_template =
+ "SUP("
+ "volfile-server=%s "
+ "volfile-id=%s "
+ "user-map-root=%s "
+ ")"
+ "SUB+("
+ "log-file="DEFAULT_LOG_FILE_DIRECTORY"/"GHADOOP"*/* "
+ "log-level=* "
+ ")";
+
int
make_georep_mountspec (gf_mount_spec_t *mspec, const char *volname,
char *user)
@@ -292,6 +303,21 @@ make_georep_mountspec (gf_mount_spec_t *mspec, const char *volname,
return parse_mount_pattern_desc (mspec, georep_mnt_desc);
}
+int
+make_ghadoop_mountspec (gf_mount_spec_t *mspec, const char *volname,
+ char *user, char *server)
+{
+ char *hadoop_mnt_desc = NULL;
+ int ret = 0;
+
+ ret = gf_asprintf (&hadoop_mnt_desc, hadoop_mnt_desc_template,
+ server, volname, user);
+ if (ret == -1)
+ return ret;
+
+ return parse_mount_pattern_desc (mspec, hadoop_mnt_desc);
+}
+
static gf_boolean_t
match_comp (char *str, char *patcomp)
{
diff --git a/xlators/mgmt/glusterd/src/glusterd-mountbroker.h b/xlators/mgmt/glusterd/src/glusterd-mountbroker.h
index e5b3d23ae57..729cf3fbc77 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.h
+++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.h
@@ -46,5 +46,7 @@ int parse_mount_pattern_desc (gf_mount_spec_t *mspec, char *pdesc);
int make_georep_mountspec (gf_mount_spec_t *mspec, const char *volname,
char *user);
+int make_ghadoop_mountspec (gf_mount_spec_t *mspec, const char *volname,
+ char *user, char *server);
int glusterd_do_mount (char *label, dict_t *argdict, char **path, int *op_errno);
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index d85777b1bf1..69923256c0a 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -664,23 +664,32 @@ check_prepare_mountbroker_root (char *mountbroker_root)
static void
_install_mount_spec (dict_t *opts, char *key, data_t *value, void *data)
{
- glusterd_conf_t *priv = THIS->private;
- char *label = NULL;
- gf_boolean_t georep = _gf_false;
- char *pdesc = value->data;
- char *volname = NULL;
- int *ret = data;
- int rv = 0;
- gf_mount_spec_t *mspec = NULL;
- char *user = NULL;
+ glusterd_conf_t *priv = THIS->private;
+ char *label = NULL;
+ gf_boolean_t georep = _gf_false;
+ gf_boolean_t ghadoop = _gf_false;
+ char *pdesc = value->data;
+ char *volname = NULL;
+ int *ret = data;
+ int rv = 0;
+ gf_mount_spec_t *mspec = NULL;
+ char *user = NULL;
+ char *volfile_server = NULL;
if (*ret == -1)
return;
label = strtail (key, "mountbroker.");
+
+ /* check for presence of geo-rep/hadoop label */
if (!label) {
- georep = _gf_true;
label = strtail (key, "mountbroker-"GEOREP".");
+ if (label)
+ georep = _gf_true;
+
+ label = strtail (key, "mountbroker-"GHADOOP".");
+ if (label)
+ ghadoop = _gf_true;
}
if (!label)
@@ -691,7 +700,7 @@ _install_mount_spec (dict_t *opts, char *key, data_t *value, void *data)
goto err;
mspec->label = label;
- if (georep) {
+ if (georep || ghadoop) {
volname = gf_strdup (pdesc);
if (!volname)
goto err;
@@ -701,7 +710,20 @@ _install_mount_spec (dict_t *opts, char *key, data_t *value, void *data)
user++;
} else
user = label;
- rv = make_georep_mountspec (mspec, volname, user);
+
+ if (georep)
+ rv = make_georep_mountspec (mspec, volname, user);
+
+ if (ghadoop) {
+ volfile_server = strchr (user, ':');
+ if (volfile_server)
+ *volfile_server++ = '\0';
+ else
+ volfile_server = "localhost";
+
+ rv = make_ghadoop_mountspec (mspec, volname, user, volfile_server);
+ }
+
GF_FREE (volname);
if (rv != 0)
goto err;
@@ -1073,6 +1095,9 @@ struct volume_options options[] = {
{ .key = {"mountbroker-"GEOREP".*"},
.type = GF_OPTION_TYPE_ANY,
},
+ { .key = {"mountbroker-"GHADOOP".*"},
+ .type = GF_OPTION_TYPE_ANY,
+ },
{ .key = {GEOREP"-log-group"},
.type = GF_OPTION_TYPE_ANY,
},