summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c1525
1 files changed, 681 insertions, 844 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index b7c7bd9b638..8d6fb5e0fac 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-shd-svc-helper.h"
#include "glusterd-gfproxyd-svc-helper.h"
struct gd_validate_reconf_opts {
@@ -89,6 +90,8 @@ xlator_instantiate_va(const char *type, const char *format, va_list arg)
xlator_t *xl = NULL;
char *volname = NULL;
int ret = 0;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
ret = gf_vasprintf(&volname, format, arg);
if (ret < 0) {
@@ -98,14 +101,21 @@ xlator_instantiate_va(const char *type, const char *format, va_list arg)
}
xl = GF_CALLOC(1, sizeof(*xl), gf_common_mt_xlator_t);
- if (!xl)
+ if (!xl) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_NO_MEMORY, NULL);
goto error;
+ }
ret = xlator_set_type_virtual(xl, type);
- if (ret)
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_XLATOR_SET_OPT_FAIL,
+ NULL);
goto error;
+ }
xl->options = dict_new();
- if (!xl->options)
+ if (!xl->options) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
goto error;
+ }
xl->name = volname;
CDS_INIT_LIST_HEAD(&xl->volume_options);
@@ -114,8 +124,8 @@ xlator_instantiate_va(const char *type, const char *format, va_list arg)
return xl;
error:
- gf_msg("glusterd", GF_LOG_ERROR, 0, GD_MSG_XLATOR_CREATE_FAIL,
- "creating xlator of type %s failed", type);
+ gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_XLATOR_CREATE_FAIL, "Type=%s",
+ type, NULL);
GF_FREE(volname);
if (xl)
xlator_destroy(xl);
@@ -123,19 +133,6 @@ error:
return NULL;
}
-static xlator_t *
-xlator_instantiate(const char *type, const char *format, ...)
-{
- va_list arg;
- xlator_t *xl;
-
- va_start(arg, format);
- xl = xlator_instantiate_va(type, format, arg);
- va_end(arg);
-
- return xl;
-}
-
static int
volgen_xlator_link(xlator_t *pxl, xlator_t *cxl)
{
@@ -322,7 +319,7 @@ volopt_trie_cbk(char *word, void *param)
}
static int
-process_nodevec(struct trienodevec *nodevec, char **hint)
+process_nodevec(struct trienodevec *nodevec, char **outputhint, char *inputhint)
{
int ret = 0;
char *hint1 = NULL;
@@ -331,14 +328,14 @@ process_nodevec(struct trienodevec *nodevec, char **hint)
trienode_t **nodes = nodevec->nodes;
if (!nodes[0]) {
- *hint = NULL;
+ *outputhint = NULL;
return 0;
}
#if 0
/* Limit as in git */
if (trienode_get_dist (nodes[0]) >= 6) {
- *hint = NULL;
+ *outputhint = NULL;
return 0;
}
#endif
@@ -347,23 +344,30 @@ process_nodevec(struct trienodevec *nodevec, char **hint)
return -1;
if (nodevec->cnt < 2 || !nodes[1]) {
- *hint = hint1;
+ *outputhint = hint1;
return 0;
}
- if (trienode_get_word(nodes[1], &hint2))
+ if (trienode_get_word(nodes[1], &hint2)) {
+ GF_FREE(hint1);
return -1;
+ }
- if (*hint)
- hintinfx = *hint;
- ret = gf_asprintf(hint, "%s or %s%s", hint1, hintinfx, hint2);
+ if (inputhint)
+ hintinfx = inputhint;
+ ret = gf_asprintf(outputhint, "%s or %s%s", hint1, hintinfx, hint2);
if (ret > 0)
ret = 0;
+ if (hint1)
+ GF_FREE(hint1);
+ if (hint2)
+ GF_FREE(hint2);
return ret;
}
static int
-volopt_trie_section(int lvl, char **patt, char *word, char **hint, int hints)
+volopt_trie_section(int lvl, char **patt, char *word, char **outputhint,
+ char *inputhint, int hints)
{
trienode_t *nodes[] = {NULL, NULL};
struct trienodevec nodevec = {nodes, 2};
@@ -384,7 +388,7 @@ volopt_trie_section(int lvl, char **patt, char *word, char **hint, int hints)
nodevec.cnt = hints;
ret = trie_measure_vec(trie, word, &nodevec);
if (!ret && nodevec.nodes[0])
- ret = process_nodevec(&nodevec, hint);
+ ret = process_nodevec(&nodevec, outputhint, inputhint);
trie_destroy(trie);
@@ -396,6 +400,7 @@ volopt_trie(char *key, char **hint)
{
char *patt[] = {NULL};
char *fullhint = NULL;
+ char *inputhint = NULL;
char *dot = NULL;
char *dom = NULL;
int len = 0;
@@ -405,7 +410,7 @@ volopt_trie(char *key, char **hint)
dot = strchr(key, '.');
if (!dot)
- return volopt_trie_section(1, patt, key, hint, 2);
+ return volopt_trie_section(1, patt, key, hint, inputhint, 2);
len = dot - key;
dom = gf_strdup(key);
@@ -413,7 +418,7 @@ volopt_trie(char *key, char **hint)
return -1;
dom[len] = '\0';
- ret = volopt_trie_section(0, NULL, dom, patt, 1);
+ ret = volopt_trie_section(0, NULL, dom, patt, inputhint, 1);
GF_FREE(dom);
if (ret) {
patt[0] = NULL;
@@ -422,8 +427,8 @@ volopt_trie(char *key, char **hint)
if (!patt[0])
goto out;
- *hint = "...";
- ret = volopt_trie_section(1, patt, dot + 1, hint, 2);
+ inputhint = "...";
+ ret = volopt_trie_section(1, patt, dot + 1, hint, inputhint, 2);
if (ret)
goto out;
if (*hint) {
@@ -463,7 +468,7 @@ struct opthandler_data {
void *param;
};
-static int
+static void
process_option(char *key, data_t *value, void *param)
{
struct opthandler_data *odt = param;
@@ -472,7 +477,7 @@ process_option(char *key, data_t *value, void *param)
};
if (odt->rv)
- return 0;
+ return;
odt->found = _gf_true;
vme.key = key;
@@ -493,7 +498,7 @@ process_option(char *key, data_t *value, void *param)
vme.value = value->data;
odt->rv = odt->handler(odt->graph, &vme, odt->param);
- return 0;
+ return;
}
static int
@@ -505,6 +510,7 @@ volgen_graph_set_options_generic(volgen_graph_t *graph, dict_t *dict,
0,
};
data_t *data = NULL;
+ int keylen;
odt.graph = graph;
odt.handler = handler;
@@ -512,16 +518,17 @@ volgen_graph_set_options_generic(volgen_graph_t *graph, dict_t *dict,
(void)data;
for (vme = glusterd_volopt_map; vme->key; vme++) {
- odt.vme = vme;
- odt.found = _gf_false;
- odt.data_t_fake = _gf_false;
-
- data = dict_get(dict, vme->key);
- if (!strcmp(vme->key, "performance.client-io-threads") &&
+ keylen = strlen(vme->key);
+ if (keylen == SLEN("performance.client-io-threads") &&
+ !strcmp(vme->key, "performance.client-io-threads") &&
dict_get_str_boolean(dict, "skip-CLIOT", _gf_false) == _gf_true) {
continue;
}
+ odt.vme = vme;
+ odt.found = _gf_false;
+ odt.data_t_fake = _gf_false;
+ data = dict_getn(dict, vme->key, keylen);
if (data)
process_option(vme->key, data, &odt);
if (odt.rv)
@@ -556,7 +563,13 @@ no_filter_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme,
for (trav = first_of(graph); trav; trav = trav->next) {
if (strcmp(trav->type, vme->voltype) != 0)
continue;
-
+ if (strcmp(vme->option, "ta-remote-port") == 0) {
+ if (strstr(trav->name, "-ta-") != NULL) {
+ ret = xlator_set_option(trav, "remote-port",
+ strlen(vme->option), vme->value);
+ }
+ continue;
+ }
ret = xlator_set_option(trav, vme->option, strlen(vme->option),
vme->value);
if (ret)
@@ -861,6 +874,8 @@ _xl_link_children(xlator_t *parent, xlator_t *children, size_t child_count)
xlator_t *trav = NULL;
size_t seek = 0;
int ret = -1;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
if (child_count == 0)
goto out;
@@ -869,9 +884,12 @@ _xl_link_children(xlator_t *parent, xlator_t *children, size_t child_count)
;
for (; child_count--; trav = trav->prev) {
ret = volgen_xlator_link(parent, trav);
- gf_msg_debug(THIS->name, 0, "%s:%s", parent->name, trav->name);
- if (ret)
+ gf_msg_debug(this->name, 0, "%s:%s", parent->name, trav->name);
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_XLATOR_LINK_FAIL,
+ NULL);
goto out;
+ }
}
ret = 0;
out:
@@ -929,8 +947,10 @@ volgen_apply_filters(char *orig_volfile)
entry = sys_readdir(filterdir, scratch);
- if (!entry || errno != 0)
+ if (!entry || errno != 0) {
+ gf_smsg("glusterd", GF_LOG_ERROR, errno, GD_MSG_READ_ERROR, NULL);
break;
+ }
if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
continue;
@@ -1116,6 +1136,7 @@ get_vol_transport_type(glusterd_volinfo_t *volinfo, char *tt)
transport_type_to_str(volinfo->transport_type, tt);
}
+#ifdef BUILD_GNFS
/* If no value has specified for tcp,rdma volume from cli
* use tcp as default value.Otherwise, use transport type
* mentioned in volinfo
@@ -1131,6 +1152,7 @@ get_vol_nfs_transport_type(glusterd_volinfo_t *volinfo, char *tt)
} else
transport_type_to_str(volinfo->transport_type, tt);
}
+#endif
/* gets the volinfo, dict, a character array for filling in
* the transport type and a boolean option which says whether
@@ -1150,9 +1172,11 @@ get_transport_type(glusterd_volinfo_t *volinfo, dict_t *set_dict, char *transt,
if (ret)
get_vol_transport_type(volinfo, transt);
} else {
+#ifdef BUILD_GNFS
ret = dict_get_str_sizen(set_dict, "nfs.transport-type", &tt);
if (ret)
get_vol_nfs_transport_type(volinfo, transt);
+#endif
}
if (!ret)
@@ -1215,6 +1239,26 @@ loglevel_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme,
}
static int
+threads_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme,
+ void *param)
+{
+ char *role = param;
+ struct volopt_map_entry vme2 = {
+ 0,
+ };
+
+ if ((strcmp(vme->option, "!client-threads") != 0 &&
+ strcmp(vme->option, "!brick-threads") != 0) ||
+ !strstr(vme->key, role))
+ return 0;
+
+ memcpy(&vme2, vme, sizeof(vme2));
+ vme2.option = "threads";
+
+ return basic_option_handler(graph, &vme2, NULL);
+}
+
+static int
server_check_changelog_off(volgen_graph_t *graph, struct volopt_map_entry *vme,
glusterd_volinfo_t *volinfo)
{
@@ -1444,14 +1488,22 @@ volgen_graph_set_xl_options(volgen_graph_t *graph, dict_t *dict)
}; /* for posix* -> *posix* */
char *loglevel = NULL;
xlator_t *trav = NULL;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
ret = dict_get_str_sizen(dict, "xlator", &xlator);
- if (ret)
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
+ "Key=xlator", NULL);
goto out;
+ }
ret = dict_get_str_sizen(dict, "loglevel", &loglevel);
- if (ret)
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
+ "Key=loglevel", NULL);
goto out;
+ }
snprintf(xlator_match, 1024, "*%s", xlator);
@@ -1506,6 +1558,9 @@ server_spec_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme,
if (!ret)
ret = log_localtime_logging_option_handler(graph, vme, "brick");
+ if (!ret)
+ ret = threads_option_handler(graph, vme, "brick");
+
return ret;
}
@@ -1548,14 +1603,22 @@ gfproxy_server_graph_builder(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char *password = NULL;
/*int rclusters = 0;*/
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
/* We are a trusted client */
ret = dict_set_uint32(set_dict, "trusted-client", GF_CLIENT_TRUSTED);
- if (ret != 0)
+ if (ret != 0) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=trusted-client", NULL);
goto out;
+ }
ret = dict_set_int32_sizen(set_dict, "gfproxy-server", 1);
- if (ret != 0)
+ if (ret != 0) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=gfproxy-server", NULL);
goto out;
+ }
/* Build the client section of the graph first */
build_client_graph(graph, volinfo, set_dict);
@@ -1613,9 +1676,18 @@ brick_graph_add_posix(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
gf_boolean_t pgfid_feat = _gf_false;
char *value = NULL;
xlator_t *xl = NULL;
+ xlator_t *this = NULL;
+ glusterd_conf_t *priv = NULL;
- if (!graph || !volinfo || !set_dict || !brickinfo)
+ this = THIS;
+
+ if (!graph || !volinfo || !set_dict || !brickinfo) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
+
+ priv = this->private;
+ GF_VALIDATE_OR_GOTO("glusterd", priv, out);
ret = glusterd_volinfo_get(volinfo, VKEY_FEATURES_QUOTA, &value);
if (value) {
@@ -1660,6 +1732,12 @@ brick_graph_add_posix(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
}
}
+ if (priv->op_version >= GD_OP_VERSION_7_0) {
+ ret = xlator_set_fixed_option(xl, "fips-mode-rchecksum", "on");
+ if (ret) {
+ goto out;
+ }
+ }
snprintf(tmpstr, sizeof(tmpstr), "%d", brickinfo->fs_share_count);
ret = xlator_set_fixed_option(xl, "shared-brick-count", tmpstr);
out:
@@ -1672,9 +1750,13 @@ brick_graph_add_selinux(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo)
+ if (!graph || !volinfo) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
xl = volgen_graph_add(graph, "features/selinux", volinfo->volname);
if (!xl)
@@ -1709,28 +1791,6 @@ out:
}
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_as(graph, "performance/decompounder",
- brickinfo->path);
- 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)
{
@@ -1755,41 +1815,6 @@ out:
}
static int
-brick_graph_add_bd(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
- dict_t *set_dict, glusterd_brickinfo_t *brickinfo)
-{
- int ret = -1;
-
- if (!graph || !volinfo || !set_dict || !brickinfo)
- goto out;
-
- ret = 0;
-
-#ifdef HAVE_BD_XLATOR
- if (*brickinfo->vg != '\0') {
- xlator_t *xl = NULL;
- /* Now add BD v2 xlator if volume is BD type */
- xl = volgen_graph_add(graph, "storage/bd", volinfo->volname);
- if (!xl) {
- ret = -1;
- goto out;
- }
-
- ret = xlator_set_fixed_option(xl, "device", "vg");
- if (ret)
- goto out;
-
- ret = xlator_set_fixed_option(xl, "export", brickinfo->vg);
- if (ret)
- goto out;
- }
-#endif
-
-out:
- return ret;
-}
-
-static int
brick_graph_add_bitrot_stub(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
dict_t *set_dict, glusterd_brickinfo_t *brickinfo)
{
@@ -1798,8 +1823,10 @@ brick_graph_add_bitrot_stub(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char *value = NULL;
xlator_t *this = THIS;
- if (!graph || !volinfo || !set_dict || !brickinfo)
+ if (!graph || !volinfo || !set_dict || !brickinfo) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
xl = volgen_graph_add(graph, "features/bitrot-stub", volinfo->volname);
if (!xl)
@@ -1834,9 +1861,13 @@ brick_graph_add_changelog(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
};
int ret = -1;
int32_t len = 0;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict || !brickinfo)
+ if (!graph || !volinfo || !set_dict || !brickinfo) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
xl = volgen_graph_add(graph, "features/changelog", volinfo->volname);
if (!xl)
@@ -1849,12 +1880,26 @@ brick_graph_add_changelog(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
len = snprintf(changelog_basepath, sizeof(changelog_basepath), "%s/%s",
brickinfo->path, ".glusterfs/changelogs");
if ((len < 0) || (len >= sizeof(changelog_basepath))) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_COPY_FAIL, NULL);
ret = -1;
goto out;
}
ret = xlator_set_fixed_option(xl, "changelog-dir", changelog_basepath);
if (ret)
goto out;
+
+ ret = glusterd_is_bitrot_enabled(volinfo);
+ if (ret == -1) {
+ goto out;
+ } else if (ret) {
+ ret = xlator_set_fixed_option(xl, "changelog-notification", "on");
+ if (ret)
+ goto out;
+ } else {
+ ret = xlator_set_fixed_option(xl, "changelog-notification", "off");
+ if (ret)
+ goto out;
+ }
out:
return ret;
}
@@ -1865,14 +1910,31 @@ brick_graph_add_acl(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict)
+ if (!graph || !volinfo || !set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
- xl = volgen_graph_add(graph, "features/access-control", volinfo->volname);
- if (!xl)
+ ret = dict_get_str_boolean(set_dict, "features.acl", 1);
+ if (!ret) {
+ /* Skip creating this volume if option is disabled */
+ /* By default, this is 'true' */
goto out;
+ } else if (ret < 0) {
+ /* lets not treat this as error, as this option is not critical,
+ and implemented for debug help */
+ gf_log(THIS->name, GF_LOG_INFO,
+ "failed to get 'features.acl' flag from dict");
+ }
+ xl = volgen_graph_add(graph, "features/access-control", volinfo->volname);
+ if (!xl) {
+ ret = -1;
+ goto out;
+ }
ret = 0;
out:
return ret;
@@ -1884,9 +1946,13 @@ brick_graph_add_locks(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict)
+ if (!graph || !volinfo || !set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
xl = volgen_graph_add(graph, "features/locks", volinfo->volname);
if (!xl)
@@ -1897,37 +1963,19 @@ out:
return ret;
}
-/* Add this before (above) io-threads because it's not thread-safe yet. */
-static int
-brick_graph_add_fdl(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
- dict_t *set_dict, glusterd_brickinfo_t *brickinfo)
-{
- xlator_t *xl = NULL;
- int ret = -1;
-
- if (!graph || !volinfo || !set_dict)
- goto out;
-
- if (dict_get_str_boolean(set_dict, "features.fdl", 0)) {
- xl = volgen_graph_add(graph, "experimental/fdl", volinfo->volname);
- if (!xl)
- goto out;
- }
- ret = 0;
-
-out:
- return ret;
-}
-
static int
brick_graph_add_iot(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
dict_t *set_dict, glusterd_brickinfo_t *brickinfo)
{
xlator_t *xl = NULL;
int ret = -1;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict)
+ if (!graph || !volinfo || !set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
xl = volgen_graph_add(graph, "performance/io-threads", volinfo->volname);
if (!xl)
@@ -1943,9 +1991,12 @@ brick_graph_add_barrier(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
+ xlator_t *this = THIS;
- if (!graph || !volinfo)
+ if (!graph || !volinfo) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
xl = volgen_graph_add(graph, "features/barrier", volinfo->volname);
if (!xl)
@@ -1962,9 +2013,13 @@ brick_graph_add_sdfs(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo)
+ if (!graph || !volinfo) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
if (!dict_get_str_boolean(set_dict, "features.sdfs", 0)) {
/* update only if option is enabled */
@@ -1975,6 +2030,11 @@ brick_graph_add_sdfs(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
xl = volgen_graph_add(graph, "features/sdfs", volinfo->volname);
if (!xl)
goto out;
+ /* If we don't set this option here, the translator by default marks
+ it 'pass-through' */
+ ret = xlator_set_fixed_option(xl, "pass-through", "false");
+ if (ret)
+ goto out;
ret = 0;
out:
@@ -1987,9 +2047,13 @@ brick_graph_add_namespace(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict)
+ if (!graph || !volinfo || !set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
ret = dict_get_str_boolean(set_dict, "features.tag-namespaces", 0);
if (ret == -1)
@@ -2033,75 +2097,6 @@ add_one_peer(volgen_graph_t *graph, glusterd_brickinfo_t *peer, char *volname,
return kid;
}
-int
-add_jbr_stuff(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
- glusterd_brickinfo_t *brickinfo)
-{
- xlator_t *me;
- glusterd_brickinfo_t *peer;
- glusterd_brickinfo_t *prev_peer;
- char *leader_opt;
- uint16_t index = 0;
- xlator_t *kid;
-
- /* Create the JBR xlator, but defer linkage for now. */
- me = xlator_instantiate("experimental/jbr", "%s-jbr", volinfo->volname);
- if (!me || volgen_xlator_link(me, first_of(graph))) {
- return -1;
- }
-
- /* Figure out if we should start as leader, mark appropriately. */
- peer = list_prev(brickinfo, &volinfo->bricks, glusterd_brickinfo_t,
- brick_list);
- leader_opt = (!peer || (peer->group != brickinfo->group)) ? "yes" : "no";
- if (xlator_set_fixed_option(me, "leader", leader_opt)) {
- /*
- * TBD: fix memory leak ("me" and associated dictionary)
- * There seems to be no function already to clean up a
- * just-allocated translator object if something else fails.
- * Apparently the convention elsewhere in this file is to return
- * without freeing anything, but we can't keep being that sloppy
- * forever.
- */
- return -1;
- }
-
- /*
- * Make sure we're at the beginning of the list of bricks in this
- * replica set. This way all bricks' volfiles have peers in a
- * consistent order.
- */
- peer = brickinfo;
- for (;;) {
- prev_peer = list_prev(peer, &volinfo->bricks, glusterd_brickinfo_t,
- brick_list);
- if (!prev_peer || (prev_peer->group != brickinfo->group)) {
- break;
- }
- peer = prev_peer;
- }
-
- /* Actually add the peers. */
- do {
- if (peer != brickinfo) {
- gf_log("glusterd", GF_LOG_INFO, "%s:%s needs client for %s:%s",
- brickinfo->hostname, brickinfo->path, peer->hostname,
- peer->path);
- kid = add_one_peer(graph, peer, volinfo->volname, index++);
- if (!kid || volgen_xlator_link(me, kid)) {
- return -1;
- }
- }
- peer = list_next(peer, &volinfo->bricks, glusterd_brickinfo_t,
- brick_list);
- } while (peer && (peer->group == brickinfo->group));
-
- /* Finish linkage to client file. */
- glusterfs_graph_set_first(&graph->graph, me);
-
- return 0;
-}
-
static int
brick_graph_add_index(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
dict_t *set_dict, glusterd_brickinfo_t *brickinfo)
@@ -2111,13 +2106,12 @@ brick_graph_add_index(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char index_basepath[PATH_MAX] = {0};
int ret = -1;
int32_t len = 0;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !brickinfo || !set_dict)
+ if (!graph || !volinfo || !brickinfo || !set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
-
- /* For JBR we don't need/want index. */
- if (glusterd_volinfo_get_boolean(volinfo, "cluster.jbr") > 0) {
- return add_jbr_stuff(graph, volinfo, brickinfo);
}
xl = volgen_graph_add(graph, "features/index", volinfo->volname);
@@ -2127,6 +2121,7 @@ brick_graph_add_index(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
len = snprintf(index_basepath, sizeof(index_basepath), "%s/%s",
brickinfo->path, ".glusterfs/indices");
if ((len < 0) || (len >= sizeof(index_basepath))) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_COPY_FAIL, NULL);
goto out;
}
@@ -2173,9 +2168,13 @@ brick_graph_add_marker(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char buf[32] = {
0,
};
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict)
+ if (!graph || !volinfo || !set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
xl = volgen_graph_add(graph, "features/marker", volinfo->volname);
if (!xl)
@@ -2206,9 +2205,13 @@ brick_graph_add_quota(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
int ret = -1;
xlator_t *xl = NULL;
char *value = NULL;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict)
+ if (!graph || !volinfo || !set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
xl = volgen_graph_add(graph, "features/quota", volinfo->volname);
if (!xl)
@@ -2234,9 +2237,13 @@ brick_graph_add_ro(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
int ret = -1;
xlator_t *xl = NULL;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict)
+ if (!graph || !volinfo || !set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
if (dict_get_str_boolean(set_dict, "features.read-only", 0) &&
(dict_get_str_boolean(set_dict, "features.worm", 0) ||
@@ -2266,9 +2273,13 @@ brick_graph_add_worm(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
int ret = -1;
xlator_t *xl = NULL;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict)
+ if (!graph || !volinfo || !set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
if (dict_get_str_boolean(set_dict, "features.read-only", 0) &&
(dict_get_str_boolean(set_dict, "features.worm", 0) ||
@@ -2295,9 +2306,13 @@ brick_graph_add_cdc(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
int ret = -1;
xlator_t *xl = NULL;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict)
+ if (!graph || !volinfo || !set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
/* Check for compress volume option, and add it to the graph on
* server side */
@@ -2324,11 +2339,15 @@ brick_graph_add_io_stats(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
int ret = -1;
xlator_t *xl = NULL;
+ xlator_t *this = THIS;
+ glusterd_conf_t *priv = this->private;
- if (!graph || !volinfo || !set_dict || !brickinfo)
+ if (!graph || !set_dict || !brickinfo) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
- xl = volgen_graph_add(graph, "debug/io-stats", volinfo->volname);
+ xl = volgen_graph_add_as(graph, "debug/io-stats", brickinfo->path);
if (!xl)
goto out;
@@ -2336,6 +2355,13 @@ brick_graph_add_io_stats(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (ret)
goto out;
+ if (priv->op_version >= GD_OP_VERSION_7_1) {
+ ret = xlator_set_fixed_option(xl, "volume-id",
+ uuid_utoa(volinfo->volume_id));
+ if (ret)
+ goto out;
+ }
+
ret = 0;
out:
return ret;
@@ -2347,9 +2373,13 @@ brick_graph_add_upcall(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict)
+ if (!graph || !volinfo || !set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
xl = volgen_graph_add(graph, "features/upcall", volinfo->volname);
if (!xl) {
@@ -2369,9 +2399,13 @@ brick_graph_add_leases(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict)
+ if (!graph || !volinfo || !set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
xl = volgen_graph_add(graph, "features/leases", volinfo->volname);
if (!xl) {
@@ -2401,9 +2435,13 @@ brick_graph_add_server(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char *volname = NULL;
char *address_family_data = NULL;
int32_t len = 0;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict || !brickinfo)
+ if (!graph || !volinfo || !set_dict || !brickinfo) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
get_vol_transport_type(volinfo, transt);
@@ -2512,13 +2550,20 @@ brick_graph_add_pump(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char *password = NULL;
char *ptranst = NULL;
char *address_family_data = NULL;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
- if (!graph || !volinfo || !set_dict)
+ if (!graph || !volinfo || !set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
+ }
ret = dict_get_int32(volinfo->dict, "enable-pump", &pump);
- if (ret == -ENOENT)
+ if (ret == -ENOENT) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
+ "Key=enable-pump", NULL);
ret = pump = 0;
+ }
if (ret)
return -1;
@@ -2594,7 +2639,6 @@ out:
* the topology of the brick graph */
static volgen_brick_xlator_t server_graph_table[] = {
{brick_graph_add_server, NULL},
- {brick_graph_add_decompounder, "decompounder"},
{brick_graph_add_io_stats, "NULL"},
{brick_graph_add_sdfs, "sdfs"},
{brick_graph_add_namespace, "namespace"},
@@ -2604,7 +2648,6 @@ static volgen_brick_xlator_t server_graph_table[] = {
{brick_graph_add_barrier, NULL},
{brick_graph_add_marker, "marker"},
{brick_graph_add_selinux, "selinux"},
- {brick_graph_add_fdl, "fdl"},
{brick_graph_add_iot, "io-threads"},
{brick_graph_add_upcall, "upcall"},
{brick_graph_add_leases, "leases"},
@@ -2615,7 +2658,6 @@ static volgen_brick_xlator_t server_graph_table[] = {
{brick_graph_add_acl, "acl"},
{brick_graph_add_bitrot_stub, "bitrot-stub"},
{brick_graph_add_changelog, "changelog"},
- {brick_graph_add_bd, "bd"},
{brick_graph_add_trash, "trash"},
{brick_graph_add_arbiter, "arbiter"},
{brick_graph_add_posix, "posix"},
@@ -2856,6 +2898,7 @@ gfproxy_client_perfxl_option_handler(volgen_graph_t *graph,
return 0;
}
+#ifdef BUILD_GNFS
static int
nfsperfxl_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme,
void *param)
@@ -2878,6 +2921,7 @@ nfsperfxl_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme,
else
return -1;
}
+#endif
#if (HAVE_LIB_XML)
int
@@ -3035,8 +3079,10 @@ _get_xlator_opt_key_from_vme(struct volopt_map_entry *vme, char **key)
*key = gf_strdup(AUTH_ALLOW_OPT_KEY);
else if (!strcmp(vme->key, AUTH_REJECT_MAP_KEY))
*key = gf_strdup(AUTH_REJECT_OPT_KEY);
+#ifdef BUILD_GNFS
else if (!strcmp(vme->key, NFS_DISABLE_MAP_KEY))
*key = gf_strdup(NFS_DISABLE_OPT_KEY);
+#endif
else {
if (vme->option) {
if (vme->option[0] == '!') {
@@ -3193,7 +3239,10 @@ volgen_graph_build_clients(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
0,
};
glusterd_brickinfo_t *brick = NULL;
+ glusterd_brickinfo_t *ta_brick = NULL;
xlator_t *xl = NULL;
+ int subvol_index = 0;
+ int thin_arbiter_index = 0;
if (volinfo->brick_count == 0) {
gf_msg("glusterd", GF_LOG_ERROR, 0, GD_MSG_VOLUME_INCONSISTENCY,
@@ -3201,8 +3250,7 @@ volgen_graph_build_clients(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
goto out;
}
- if ((volinfo->type != GF_CLUSTER_TYPE_TIER) &&
- (volinfo->dist_leaf_count < volinfo->brick_count) &&
+ if ((volinfo->dist_leaf_count < volinfo->brick_count) &&
((volinfo->brick_count % volinfo->dist_leaf_count) != 0)) {
gf_msg("glusterd", GF_LOG_ERROR, 0, GD_MSG_VOLUME_INCONSISTENCY,
"volume inconsistency: "
@@ -3221,6 +3269,30 @@ volgen_graph_build_clients(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
i = 0;
cds_list_for_each_entry(brick, &volinfo->bricks, brick_list)
{
+ /* insert ta client xlator entry.
+ * eg - If subvol count is > 1, then after every two client xlator
+ * entries there should be a ta client xlator entry in the volfile. ta
+ * client xlator indexes are - 2, 5, 8 etc depending on the index of
+ * subvol.
+ */
+ if (volinfo->thin_arbiter_count &&
+ (i + 1) % (volinfo->replica_count + 1) == 0) {
+ thin_arbiter_index = 0;
+ cds_list_for_each_entry(ta_brick, &volinfo->ta_bricks, brick_list)
+ {
+ if (thin_arbiter_index == subvol_index) {
+ xl = volgen_graph_build_client(
+ graph, volinfo, ta_brick->hostname, NULL,
+ ta_brick->path, ta_brick->brick_id, transt, set_dict);
+ if (!xl) {
+ ret = -1;
+ goto out;
+ }
+ }
+ thin_arbiter_index++;
+ }
+ subvol_index++;
+ }
xl = volgen_graph_build_client(graph, volinfo, brick->hostname, NULL,
brick->path, brick->brick_id, transt,
set_dict);
@@ -3232,6 +3304,28 @@ volgen_graph_build_clients(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
i++;
}
+ /* Add ta client xlator entry for last subvol
+ * Above loop will miss out on making the ta client
+ * xlator entry for the last subvolume in the volfile
+ */
+ if (volinfo->thin_arbiter_count) {
+ thin_arbiter_index = 0;
+ cds_list_for_each_entry(ta_brick, &volinfo->ta_bricks, brick_list)
+ {
+ if (thin_arbiter_index == subvol_index) {
+ xl = volgen_graph_build_client(
+ graph, volinfo, ta_brick->hostname, NULL, ta_brick->path,
+ ta_brick->brick_id, transt, set_dict);
+ if (!xl) {
+ ret = -1;
+ goto out;
+ }
+ }
+
+ thin_arbiter_index++;
+ }
+ }
+
if (i != volinfo->brick_count) {
gf_msg("glusterd", GF_LOG_ERROR, 0, GD_MSG_VOLUME_INCONSISTENCY,
"volume inconsistency: actual number of bricks (%d) "
@@ -3247,50 +3341,6 @@ out:
}
static int
-volgen_graph_build_clients_for_tier_shd(volgen_graph_t *graph,
- glusterd_volinfo_t *volinfo,
- dict_t *set_dict)
-{
- int ret = 0;
- glusterd_volinfo_t *dup_volinfo = NULL;
- gf_boolean_t is_hot_tier = _gf_false;
- gf_boolean_t is_hot_shd = _gf_false;
- gf_boolean_t is_cold_shd = _gf_false;
-
- is_cold_shd = glusterd_is_shd_compatible_type(volinfo->tier_info.cold_type);
- is_hot_shd = glusterd_is_shd_compatible_type(volinfo->tier_info.hot_type);
-
- if (is_cold_shd && is_hot_shd) {
- ret = volgen_graph_build_clients(graph, volinfo, set_dict, NULL);
- return ret;
- }
-
- if (is_cold_shd) {
- ret = glusterd_create_sub_tier_volinfo(volinfo, &dup_volinfo,
- is_hot_tier, volinfo->volname);
- if (ret)
- goto out;
- ret = volgen_graph_build_clients(graph, dup_volinfo, set_dict, NULL);
- if (ret)
- goto out;
- }
- if (is_hot_shd) {
- is_hot_tier = _gf_true;
- ret = glusterd_create_sub_tier_volinfo(volinfo, &dup_volinfo,
- is_hot_tier, volinfo->volname);
- if (ret)
- goto out;
- ret = volgen_graph_build_clients(graph, dup_volinfo, set_dict, NULL);
- if (ret)
- goto out;
- }
-out:
- if (dup_volinfo)
- glusterd_volinfo_delete(dup_volinfo);
- return ret;
-}
-
-static int
volgen_link_bricks(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char *xl_type, char *xl_namefmt, size_t child_count,
size_t sub_count, size_t start_count, xlator_t *trav)
@@ -3311,11 +3361,20 @@ volgen_link_bricks(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
j);
j++;
}
+
if (!xl) {
ret = -1;
goto out;
}
+ if (strncmp(xl_type, "performance/readdir-ahead",
+ SLEN("performance/readdir-ahead")) == 0) {
+ ret = xlator_set_fixed_option(xl, "performance.readdir-ahead",
+ "on");
+ if (ret)
+ goto out;
+ }
+
ret = volgen_xlator_link(xl, trav);
if (ret)
goto out;
@@ -3351,22 +3410,6 @@ volgen_link_bricks_from_list_tail_start(volgen_graph_t *graph,
}
static int
-volgen_link_bricks_from_list_head_start(volgen_graph_t *graph,
- glusterd_volinfo_t *volinfo,
- char *xl_type, char *xl_namefmt,
- size_t child_count, size_t sub_count,
- size_t start_count)
-{
- xlator_t *trav = NULL;
-
- for (trav = first_of(graph); trav->next; trav = trav->next)
- ;
-
- return volgen_link_bricks(graph, volinfo, xl_type, xl_namefmt, child_count,
- sub_count, start_count, trav);
-}
-
-static int
volgen_link_bricks_from_list_tail(volgen_graph_t *graph,
glusterd_volinfo_t *volinfo, char *xl_type,
char *xl_namefmt, size_t child_count,
@@ -3385,21 +3428,6 @@ volgen_link_bricks_from_list_tail(volgen_graph_t *graph,
sub_count, 0, trav);
}
-static int
-volgen_link_bricks_from_list_head(volgen_graph_t *graph,
- glusterd_volinfo_t *volinfo, char *xl_type,
- char *xl_namefmt, size_t child_count,
- size_t sub_count)
-{
- xlator_t *trav = NULL;
-
- for (trav = first_of(graph); trav->next; trav = trav->next)
- ;
-
- return volgen_link_bricks(graph, volinfo, xl_type, xl_namefmt, child_count,
- sub_count, 0, trav);
-}
-
/**
* This is the build graph function for user-serviceable snapshots.
* Generates snapview-client
@@ -3574,13 +3602,13 @@ volgen_graph_build_readdir_ahead(volgen_graph_t *graph,
int32_t clusters = 0;
if (graph->type == GF_QUOTAD || graph->type == GF_SNAPD ||
- !glusterd_volinfo_get_boolean(volinfo, VKEY_PARALLEL_READDIR) ||
- !glusterd_volinfo_get_boolean(volinfo, VKEY_READDIR_AHEAD))
+ !glusterd_volinfo_get_boolean(volinfo, VKEY_PARALLEL_READDIR))
goto out;
clusters = volgen_link_bricks_from_list_tail(
graph, volinfo, "performance/readdir-ahead", "%s-readdir-ahead-%d",
child_count, 1);
+
out:
return clusters;
}
@@ -3624,11 +3652,6 @@ volgen_graph_build_dht_cluster(volgen_graph_t *graph,
if (clusters < 0)
goto out;
- if (volinfo->type == GF_CLUSTER_TYPE_TIER) {
- ret = 0;
- goto out;
- }
-
dht = first_of(graph);
ret = _graph_get_decommissioned_children(dht, volinfo,
&decommissioned_children);
@@ -3658,11 +3681,6 @@ volgen_graph_build_ec_clusters(volgen_graph_t *graph,
char option[32] = {0};
int start_count = 0;
- if (volinfo->tier_info.cur_tier_hot &&
- volinfo->tier_info.cold_type == GF_CLUSTER_TYPE_DISPERSE)
- start_count = volinfo->tier_info.cold_brick_count /
- volinfo->tier_info.cold_disperse_count;
-
clusters = volgen_link_bricks_from_list_tail_start(
graph, volinfo, disperse_args[0], disperse_args[1],
volinfo->brick_count, volinfo->disperse_count, start_count);
@@ -3693,12 +3711,15 @@ set_afr_pending_xattrs_option(volgen_graph_t *graph,
xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
glusterd_brickinfo_t *brick = NULL;
+ glusterd_brickinfo_t *ta_brick = NULL;
char *ptr = NULL;
int i = 0;
int index = -1;
int ret = 0;
char *afr_xattrs_list = NULL;
int list_size = -1;
+ int ta_brick_index = 0;
+ int subvol_index = 0;
this = THIS;
GF_VALIDATE_OR_GOTO("glusterd", this, out);
@@ -3737,6 +3758,36 @@ set_afr_pending_xattrs_option(volgen_graph_t *graph,
break;
strncat(ptr, brick->brick_id, strlen(brick->brick_id));
if (i == volinfo->replica_count) {
+ /* add ta client xlator in afr-pending-xattrs before making entries
+ * for client xlators in volfile.
+ * ta client xlator indexes are - 2, 5, 8 depending on the index of
+ * subvol. e.g- For first subvol ta client xlator id is volname-ta-2
+ * For pending-xattr, ta name would be
+ * 'volname-ta-2.{{volume-uuid}}' from GD_OP_VERSION_7_3.
+ */
+ ta_brick_index = 0;
+ if (volinfo->thin_arbiter_count == 1) {
+ ptr[strlen(brick->brick_id)] = ',';
+ cds_list_for_each_entry(ta_brick, &volinfo->ta_bricks,
+ brick_list)
+ {
+ if (ta_brick_index == subvol_index) {
+ break;
+ }
+ ta_brick_index++;
+ }
+ if (conf->op_version < GD_OP_VERSION_7_3) {
+ strncat(ptr, ta_brick->brick_id,
+ strlen(ta_brick->brick_id));
+ } else {
+ char ta_volname[PATH_MAX] = "";
+ int len = snprintf(ta_volname, PATH_MAX, "%s.%s",
+ ta_brick->brick_id,
+ uuid_utoa(volinfo->volume_id));
+ strncat(ptr, ta_volname, len);
+ }
+ }
+
ret = xlator_set_fixed_option(afr_xlators_list[index++],
"afr-pending-xattr", afr_xattrs_list);
if (ret)
@@ -3744,6 +3795,7 @@ set_afr_pending_xattrs_option(volgen_graph_t *graph,
memset(afr_xattrs_list, 0, list_size);
ptr = afr_xattrs_list;
i = 1;
+ subvol_index++;
continue;
}
ptr[strlen(brick->brick_id)] = ',';
@@ -3758,36 +3810,70 @@ out:
}
static int
+set_volfile_id_option(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
+ int clusters)
+{
+ xlator_t *xlator = NULL;
+ int i = 0;
+ int ret = -1;
+ glusterd_conf_t *conf = NULL;
+ xlator_t *this = NULL;
+
+ this = THIS;
+ GF_VALIDATE_OR_GOTO("glusterd", this, out);
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
+
+ if (conf->op_version < GD_OP_VERSION_9_0)
+ return 0;
+ xlator = first_of(graph);
+
+ for (i = 0; i < clusters; i++) {
+ ret = xlator_set_fixed_option(xlator, "volume-id",
+ uuid_utoa(volinfo->volume_id));
+ if (ret)
+ goto out;
+
+ xlator = xlator->next;
+ }
+
+out:
+ return ret;
+}
+
+static int
volgen_graph_build_afr_clusters(volgen_graph_t *graph,
glusterd_volinfo_t *volinfo)
{
int i = 0;
int ret = 0;
int clusters = 0;
- char *replicate_type = NULL;
+ char *replicate_type = "cluster/replicate";
char *replicate_name = "%s-replicate-%d";
xlator_t *afr = NULL;
char option[32] = {0};
- int start_count = 0;
+ glusterd_brickinfo_t *ta_brick = NULL;
+ int ta_brick_index = 0;
+ int ta_replica_offset = 0;
+ int ta_brick_offset = 0;
+ char ta_option[4096] = {
+ 0,
+ };
- if (glusterd_volinfo_get_boolean(volinfo, "cluster.jbr") > 0) {
- replicate_type = "experimental/jbrc";
- } else {
- replicate_type = "cluster/replicate";
+ /* In thin-arbiter case brick count and replica count remain same
+ * but due to additional entries of ta client xlators in the volfile,
+ * GD1 is manipulated to include these client xlators while linking them to
+ * afr/cluster entry in the volfile.
+ */
+ if (volinfo->thin_arbiter_count == 1) {
+ ta_replica_offset = 1;
+ ta_brick_offset = volinfo->subvol_count;
}
- if (volinfo->tier_info.cold_type == GF_CLUSTER_TYPE_REPLICATE)
- start_count = volinfo->tier_info.cold_brick_count /
- volinfo->tier_info.cold_replica_count;
-
- if (volinfo->tier_info.cur_tier_hot)
- clusters = volgen_link_bricks_from_list_head_start(
- graph, volinfo, replicate_type, replicate_name,
- volinfo->brick_count, volinfo->replica_count, start_count);
- else
- clusters = volgen_link_bricks_from_list_tail(
- graph, volinfo, replicate_type, replicate_name,
- volinfo->brick_count, volinfo->replica_count);
+ clusters = volgen_link_bricks_from_list_tail(
+ graph, volinfo, replicate_type, replicate_name,
+ volinfo->brick_count + ta_brick_offset,
+ volinfo->replica_count + ta_replica_offset);
if (clusters < 0)
goto out;
@@ -3797,18 +3883,50 @@ volgen_graph_build_afr_clusters(volgen_graph_t *graph,
clusters = -1;
goto out;
}
- if (!volinfo->arbiter_count)
+
+ ret = set_volfile_id_option(graph, volinfo, clusters);
+ if (ret) {
+ clusters = -1;
+ goto out;
+ }
+
+ if (!volinfo->arbiter_count && !volinfo->thin_arbiter_count)
goto out;
afr = first_of(graph);
- sprintf(option, "%d", volinfo->arbiter_count);
- for (i = 0; i < clusters; i++) {
- ret = xlator_set_fixed_option(afr, "arbiter-count", option);
- if (ret) {
- clusters = -1;
- goto out;
+
+ if (volinfo->arbiter_count) {
+ sprintf(option, "%d", volinfo->arbiter_count);
+ for (i = 0; i < clusters; i++) {
+ ret = xlator_set_fixed_option(afr, "arbiter-count", option);
+ if (ret) {
+ clusters = -1;
+ goto out;
+ }
+
+ afr = afr->next;
+ }
+ }
+
+ if (volinfo->thin_arbiter_count == 1) {
+ for (i = 0; i < clusters; i++) {
+ ta_brick_index = 0;
+ cds_list_for_each_entry(ta_brick, &volinfo->ta_bricks, brick_list)
+ {
+ if (ta_brick_index == i) {
+ break;
+ }
+ ta_brick_index++;
+ }
+ snprintf(ta_option, sizeof(ta_option), "%s:%s", ta_brick->hostname,
+ ta_brick->path);
+ ret = xlator_set_fixed_option(afr, "thin-arbiter", ta_option);
+ if (ret) {
+ clusters = -1;
+ goto out;
+ }
+ afr = afr->next;
}
- afr = afr->next;
}
out:
return clusters;
@@ -3819,13 +3937,9 @@ volume_volgen_graph_build_clusters(volgen_graph_t *graph,
glusterd_volinfo_t *volinfo,
gf_boolean_t is_quotad)
{
- char *tier_args[] = {"cluster/tier", "%s-tier-%d"};
int clusters = 0;
int dist_count = 0;
int ret = -1;
- char tmp_volname[GD_VOLUME_NAME_MAX_TIER] = {
- 0,
- };
if (!volinfo->dist_leaf_count)
goto out;
@@ -3840,11 +3954,6 @@ volume_volgen_graph_build_clusters(volgen_graph_t *graph,
if (clusters < 0)
goto out;
break;
- case GF_CLUSTER_TYPE_TIER:
- ret = volgen_link_bricks_from_list_head(
- graph, volinfo, tier_args[0], tier_args[1],
- volinfo->brick_count, volinfo->replica_count);
- break;
case GF_CLUSTER_TYPE_DISPERSE:
clusters = volgen_graph_build_ec_clusters(graph, volinfo);
if (clusters < 0)
@@ -3864,24 +3973,11 @@ build_distribute:
ret = -1;
goto out;
}
- if (volinfo->tier_info.hot_brick_count) {
- if (snprintf(tmp_volname, GD_VOLUME_NAME_MAX_TIER, "%s",
- volinfo->volname) >= GD_VOLUME_NAME_MAX_TIER) {
- ret = -1;
- goto out;
- }
- if (volinfo->tier_info.cur_tier_hot)
- strcat(volinfo->volname, "-hot");
- else
- strcat(volinfo->volname, "-cold");
- }
clusters = volgen_graph_build_readdir_ahead(graph, volinfo, dist_count);
if (clusters < 0)
goto out;
ret = volgen_graph_build_dht_cluster(graph, volinfo, dist_count, is_quotad);
- if (volinfo->tier_info.hot_brick_count)
- strcpy(volinfo->volname, tmp_volname);
if (ret)
goto out;
@@ -3984,8 +4080,6 @@ static int
client_graph_set_perf_options(volgen_graph_t *graph,
glusterd_volinfo_t *volinfo, dict_t *set_dict)
{
- data_t *tmp_data = NULL;
- char *volname = NULL;
int ret = 0;
/*
@@ -4014,15 +4108,19 @@ client_graph_set_perf_options(volgen_graph_t *graph,
if (ret < 0)
return ret;
- volname = volinfo->volname;
+#ifdef BUILD_GNFS
+ data_t *tmp_data = NULL;
+ char *volname = NULL;
tmp_data = dict_get_sizen(set_dict, "nfs-volume-file");
- if (!tmp_data)
- return volgen_graph_set_options_generic(graph, set_dict, volinfo,
- &perfxl_option_handler);
- else
+ if (tmp_data) {
+ volname = volinfo->volname;
return volgen_graph_set_options_generic(graph, set_dict, volname,
&nfsperfxl_option_handler);
+ } else
+#endif
+ return volgen_graph_set_options_generic(graph, set_dict, volinfo,
+ &perfxl_option_handler);
}
static int
@@ -4085,138 +4183,15 @@ graph_set_generic_options(xlator_t *this, volgen_graph_t *graph,
gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_GRAPH_SET_OPT_FAIL,
"Failed to change "
"log-localtime-logging option");
- return 0;
-}
-
-static int
-volume_volgen_graph_build_clusters_tier(volgen_graph_t *graph,
- glusterd_volinfo_t *volinfo,
- gf_boolean_t is_quotad)
-{
- int ret = -1;
- xlator_t *xl, *hxl, *cxl;
- char *rule = NULL;
- int st_brick_count = 0;
- int st_replica_count = 0;
- int st_disperse_count = 0;
- int st_dist_leaf_count = 0;
- int st_type = 0;
- int dist_count = 0;
- int start_count = 0;
- char *decommissioned_children = NULL;
- glusterd_volinfo_t *dup_volinfo = NULL;
- gf_boolean_t is_hot_tier = _gf_false;
-
- st_brick_count = volinfo->brick_count;
- st_replica_count = volinfo->replica_count;
- st_disperse_count = volinfo->disperse_count;
- st_type = volinfo->type;
- st_dist_leaf_count = volinfo->dist_leaf_count;
-
- volinfo->dist_leaf_count = volinfo->tier_info.cold_dist_leaf_count;
- volinfo->brick_count = volinfo->tier_info.cold_brick_count;
- volinfo->replica_count = volinfo->tier_info.cold_replica_count;
- volinfo->disperse_count = volinfo->tier_info.cold_disperse_count;
- volinfo->redundancy_count = volinfo->tier_info.cold_redundancy_count;
- volinfo->type = volinfo->tier_info.cold_type;
- volinfo->tier_info.cur_tier_hot = 0;
- ret = glusterd_create_sub_tier_volinfo(volinfo, &dup_volinfo, is_hot_tier,
- volinfo->volname);
- if (ret)
- goto out;
-
- ret = volume_volgen_graph_build_clusters(graph, dup_volinfo, is_quotad);
- if (ret)
- goto out;
- cxl = first_of(graph);
-
- volinfo->type = volinfo->tier_info.hot_type;
- volinfo->brick_count = volinfo->tier_info.hot_brick_count;
- volinfo->replica_count = volinfo->tier_info.hot_replica_count;
- volinfo->dist_leaf_count = glusterd_get_dist_leaf_count(volinfo);
- volinfo->disperse_count = 0;
- volinfo->tier_info.cur_tier_hot = 1;
- dist_count = volinfo->brick_count / volinfo->dist_leaf_count;
-
- if (volinfo->tier_info.cold_type == GF_CLUSTER_TYPE_REPLICATE) {
- start_count = volinfo->tier_info.cold_brick_count /
- volinfo->tier_info.cold_replica_count;
- }
-
- if (volinfo->dist_leaf_count != 1) {
- ret = volgen_link_bricks_from_list_head_start(
- graph, volinfo, "cluster/replicate", "%s-replicate-%d",
- volinfo->brick_count, volinfo->replica_count, start_count);
- if (ret != -1) {
- ret = set_afr_pending_xattrs_option(graph, volinfo, ret);
- if (ret)
- goto out;
- volgen_link_bricks_from_list_tail(
- graph, volinfo, "cluster/distribute", "%s-hot-dht", dist_count,
- dist_count);
- }
- } else {
- ret = volgen_link_bricks_from_list_head(
- graph, volinfo, "cluster/distribute", "%s-hot-dht", dist_count,
- dist_count);
- }
- if (ret == -1)
- goto out;
-
- hxl = first_of(graph);
-
- volinfo->type = GF_CLUSTER_TYPE_TIER;
- if (!is_quotad) {
- xl = volgen_graph_add_nolink(graph, "cluster/tier", "%s-%s",
- volinfo->volname, "tier-dht");
- } else {
- xl = volgen_graph_add_nolink(graph, "cluster/tier", "%s",
- volinfo->volname);
- }
- if (!xl)
- goto out;
-
- gf_asprintf(&rule, "%s-hot-dht", volinfo->volname);
-
- ret = xlator_set_fixed_option(xl, "rule", rule);
- if (ret)
- goto out;
-
- /*Each dht/tier layer must have a different xattr name*/
- ret = xlator_set_fixed_option(xl, "xattr-name", "trusted.tier.tier-dht");
- if (ret)
- goto out;
-
- ret = volgen_xlator_link(xl, cxl);
- ret = volgen_xlator_link(xl, hxl);
-
- st_type = GF_CLUSTER_TYPE_TIER;
+ ret = volgen_graph_set_options_generic(graph, set_dict, "client",
+ &threads_option_handler);
- ret = _graph_get_decommissioned_children(xl, volinfo,
- &decommissioned_children);
if (ret)
- goto out;
- if (decommissioned_children) {
- ret = xlator_set_fixed_option(xl, "decommissioned-bricks",
- decommissioned_children);
- if (ret)
- goto out;
- }
+ gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_GRAPH_SET_OPT_FAIL,
+ "changing %s threads failed", identifier);
-out:
- volinfo->brick_count = st_brick_count;
- volinfo->replica_count = st_replica_count;
- volinfo->disperse_count = st_disperse_count;
- volinfo->type = st_type;
- volinfo->dist_leaf_count = st_dist_leaf_count;
- volinfo->tier_info.cur_tier_hot = 0;
-
- if (dup_volinfo)
- glusterd_volinfo_delete(dup_volinfo);
- GF_FREE(rule);
- GF_FREE(decommissioned_children);
- return ret;
+ return 0;
}
static int
@@ -4250,9 +4225,6 @@ client_graph_builder(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (ret)
goto out;
- if (volinfo->type == GF_CLUSTER_TYPE_TIER)
- ret = volume_volgen_graph_build_clusters_tier(graph, volinfo,
- _gf_false);
else
ret = volume_volgen_graph_build_clusters(graph, volinfo, _gf_false);
@@ -4271,6 +4243,18 @@ client_graph_builder(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
"tcp", set_dict);
}
+ ret = dict_get_str_boolean(set_dict, "features.cloudsync", _gf_false);
+ if (ret == -1)
+ goto out;
+
+ if (ret) {
+ xl = volgen_graph_add(graph, "features/cloudsync", volname);
+ if (!xl) {
+ ret = -1;
+ goto out;
+ }
+ }
+
ret = dict_get_str_boolean(set_dict, "features.shard", _gf_false);
if (ret == -1)
goto out;
@@ -4282,8 +4266,15 @@ client_graph_builder(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
goto out;
}
}
-
- if (conf->op_version >= GD_OP_VERSION_5_0) {
+ /* a. ret will be -1 if features.ctime is not set in the volinfo->dict which
+ * means ctime should be loaded into the graph.
+ * b. ret will be 1 if features.ctime is explicitly turned on through
+ * volume set and in that case ctime should be loaded into the graph.
+ * c. ret will be 0 if features.ctime is explicitly turned off and in that
+ * case ctime shouldn't be loaded into the graph.
+ */
+ ret = dict_get_str_boolean(set_dict, "features.ctime", -1);
+ if (conf->op_version >= GD_OP_VERSION_5_0 && ret) {
xl = volgen_graph_add(graph, "features/utime", volname);
if (!xl) {
ret = -1;
@@ -4326,17 +4317,6 @@ client_graph_builder(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
goto out;
}
- ret = dict_get_str_boolean(set_dict, "features.encryption", _gf_false);
- if (ret == -1)
- goto out;
- if (ret) {
- xl = volgen_graph_add(graph, "encryption/crypt", volname);
- if (!xl) {
- ret = -1;
- goto out;
- }
- }
-
/* gfproxy needs the quiesce translator */
if (gfproxy_clnt) {
xl = volgen_graph_add(graph, "features/quiesce", volname);
@@ -4471,18 +4451,6 @@ client_graph_builder(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (ret)
return -1;
- ret = dict_get_str_boolean(set_dict, "features.cloudsync", _gf_false);
- if (ret == -1)
- goto out;
-
- if (ret) {
- xl = volgen_graph_add(graph, "features/cloudsync", volname);
- if (!xl) {
- ret = -1;
- goto out;
- }
- }
-
/* if the client is part of 'gfproxyd' server, then we need to keep the
volume name as 'gfproxyd-<volname>', for better portmapper options */
subvol = volname;
@@ -4538,6 +4506,12 @@ bitrot_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme,
return -1;
}
+ if (!strcmp(vme->option, "signer-threads")) {
+ ret = xlator_set_fixed_option(xl, "signer-threads", vme->value);
+ if (ret)
+ return -1;
+ }
+
return ret;
}
@@ -4594,158 +4568,92 @@ out:
return ret;
}
+#ifdef BUILD_GNFS
static int
nfs_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme,
void *param)
{
+ static struct nfs_opt nfs_opts[] = {
+ /* {pattern, printf_pattern} */
+ {"!rpc-auth.addr.*.allow", "rpc-auth.addr.%s.allow"},
+ {"!rpc-auth.addr.*.reject", "rpc-auth.addr.%s.reject"},
+ {"!rpc-auth.auth-unix.*", "rpc-auth.auth-unix.%s"},
+ {"!rpc-auth.auth-null.*", "rpc-auth.auth-null.%s"},
+ {"!nfs3.*.trusted-sync", "nfs3.%s.trusted-sync"},
+ {"!nfs3.*.trusted-write", "nfs3.%s.trusted-write"},
+ {"!nfs3.*.volume-access", "nfs3.%s.volume-access"},
+ {"!rpc-auth.ports.*.insecure", "rpc-auth.ports.%s.insecure"},
+ {"!nfs-disable", "nfs.%s.disable"},
+ {NULL, NULL}};
xlator_t *xl = NULL;
char *aa = NULL;
int ret = 0;
glusterd_volinfo_t *volinfo = NULL;
+ int keylen;
+ struct nfs_opt *opt = NULL;
volinfo = param;
- xl = first_of(graph);
-
- if (!volinfo || (volinfo->volname[0] == '\0'))
- return 0;
-
- if (!vme || !(vme->option))
+ if (!volinfo || (volinfo->volname[0] == '\0')) {
+ gf_smsg("glusterd", GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
return 0;
-
- if (!strcmp(vme->option, "!rpc-auth.addr.*.allow")) {
- ret = gf_asprintf(&aa, "rpc-auth.addr.%s.allow", volinfo->volname);
-
- if (ret != -1) {
- ret = xlator_set_option(xl, aa, ret, vme->value);
- GF_FREE(aa);
- }
-
- if (ret)
- return -1;
}
- if (!strcmp(vme->option, "!rpc-auth.addr.*.reject")) {
- ret = gf_asprintf(&aa, "rpc-auth.addr.%s.reject", volinfo->volname);
-
- if (ret != -1) {
- ret = xlator_set_option(xl, aa, ret, vme->value);
- GF_FREE(aa);
- }
-
- if (ret)
- return -1;
- }
-
- if (!strcmp(vme->option, "!rpc-auth.auth-unix.*")) {
- ret = gf_asprintf(&aa, "rpc-auth.auth-unix.%s", volinfo->volname);
-
- if (ret != -1) {
- ret = xlator_set_option(xl, aa, ret, vme->value);
- GF_FREE(aa);
- }
-
- if (ret)
- return -1;
- }
- if (!strcmp(vme->option, "!rpc-auth.auth-null.*")) {
- ret = gf_asprintf(&aa, "rpc-auth.auth-null.%s", volinfo->volname);
-
- if (ret != -1) {
- ret = xlator_set_option(xl, aa, ret, vme->value);
- GF_FREE(aa);
- }
-
- if (ret)
- return -1;
- }
-
- if (!strcmp(vme->option, "!nfs3.*.trusted-sync")) {
- ret = gf_asprintf(&aa, "nfs3.%s.trusted-sync", volinfo->volname);
-
- if (ret != -1) {
- ret = xlator_set_option(xl, aa, ret, vme->value);
- GF_FREE(aa);
- }
-
- if (ret)
- return -1;
+ if (!vme || !(vme->option)) {
+ gf_smsg("glusterd", GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ return 0;
}
- if (!strcmp(vme->option, "!nfs3.*.trusted-write")) {
- ret = gf_asprintf(&aa, "nfs3.%s.trusted-write", volinfo->volname);
-
- if (ret != -1) {
- ret = xlator_set_option(xl, aa, ret, vme->value);
- GF_FREE(aa);
- }
+ xl = first_of(graph);
- if (ret)
- return -1;
- }
+ for (opt = nfs_opts; opt->pattern; opt++) {
+ if (!strcmp(vme->option, opt->pattern)) {
+ keylen = gf_asprintf(&aa, opt->printf_pattern, volinfo->volname);
- if (!strcmp(vme->option, "!nfs3.*.volume-access")) {
- ret = gf_asprintf(&aa, "nfs3.%s.volume-access", volinfo->volname);
+ if (keylen == -1) {
+ return -1;
+ }
- if (ret != -1) {
- ret = xlator_set_option(xl, aa, ret, vme->value);
+ ret = xlator_set_option(xl, aa, keylen, vme->value);
GF_FREE(aa);
- }
-
- if (ret)
- return -1;
- }
-
- if (!strcmp(vme->option, "!nfs3.*.export-dir")) {
- ret = gf_asprintf(&aa, "nfs3.%s.export-dir", volinfo->volname);
- if (ret != -1) {
- ret = gf_canonicalize_path(vme->value);
if (ret)
return -1;
- ret = xlator_set_option(xl, aa, ret, vme->value);
- GF_FREE(aa);
+ goto out;
}
-
- if (ret)
- return -1;
}
- if (!strcmp(vme->option, "!rpc-auth.ports.*.insecure")) {
- ret = gf_asprintf(&aa, "rpc-auth.ports.%s.insecure", volinfo->volname);
-
- if (ret != -1) {
- ret = xlator_set_option(xl, aa, ret, vme->value);
- GF_FREE(aa);
- }
+ if (!strcmp(vme->option, "!nfs3.*.export-dir")) {
+ keylen = gf_asprintf(&aa, "nfs3.%s.export-dir", volinfo->volname);
- if (ret)
+ if (keylen == -1) {
return -1;
- }
-
- if (!strcmp(vme->option, "!nfs-disable")) {
- ret = gf_asprintf(&aa, "nfs.%s.disable", volinfo->volname);
+ }
- if (ret != -1) {
- ret = xlator_set_option(xl, aa, ret, vme->value);
+ ret = gf_canonicalize_path(vme->value);
+ if (ret) {
GF_FREE(aa);
+ return -1;
}
+ ret = xlator_set_option(xl, aa, keylen, vme->value);
+ GF_FREE(aa);
if (ret)
return -1;
- }
-
- if ((strcmp(vme->voltype, "nfs/server") == 0) && (vme->option[0] != '!')) {
+ } else if ((strcmp(vme->voltype, "nfs/server") == 0) &&
+ (vme->option[0] != '!')) {
ret = xlator_set_option(xl, vme->option, strlen(vme->option),
vme->value);
if (ret)
return -1;
}
+out:
return 0;
}
+#endif
char *
volgen_get_shd_key(int type)
{
@@ -4769,7 +4677,7 @@ volgen_get_shd_key(int type)
static int
volgen_set_shd_key_enable(dict_t *set_dict, const int type)
{
- int ret = -1;
+ int ret = 0;
switch (type) {
case GF_CLUSTER_TYPE_REPLICATE:
@@ -4815,41 +4723,21 @@ volgen_graph_set_iam_shd(volgen_graph_t *graph)
}
static int
-glusterd_prepare_shd_volume_options_for_tier(glusterd_volinfo_t *volinfo,
- dict_t *set_dict)
-{
- int ret = -1;
-
- ret = volgen_set_shd_key_enable(set_dict, volinfo->tier_info.cold_type);
- if (ret)
- goto out;
-
- ret = volgen_set_shd_key_enable(set_dict, volinfo->tier_info.hot_type);
- if (ret)
- goto out;
-out:
- return ret;
-}
-
-static int
prepare_shd_volume_options(glusterd_volinfo_t *volinfo, dict_t *mod_dict,
dict_t *set_dict)
{
int ret = 0;
- if (volinfo->type == GF_CLUSTER_TYPE_TIER) {
- ret = glusterd_prepare_shd_volume_options_for_tier(volinfo, set_dict);
- if (ret)
- goto out;
- } else {
- ret = volgen_set_shd_key_enable(set_dict, volinfo->type);
- if (ret)
- goto out;
- }
+ ret = volgen_set_shd_key_enable(set_dict, volinfo->type);
+ if (ret)
+ goto out;
ret = dict_set_uint32(set_dict, "trusted-client", GF_CLIENT_TRUSTED);
- if (ret)
+ if (ret) {
+ gf_smsg("glusterd", GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=trusted-client", NULL);
goto out;
+ }
dict_copy(volinfo->dict, set_dict);
if (mod_dict)
@@ -4875,70 +4763,17 @@ build_afr_ec_clusters(volgen_graph_t *graph, glusterd_volinfo_t *volinfo)
}
static int
-build_afr_ec_clusters_for_tier(volgen_graph_t *graph,
- glusterd_volinfo_t *volinfo, dict_t *set_dict)
-{
- int ret = 0;
- glusterd_volinfo_t *dup_volinfo[2] = {NULL, NULL};
- int clusters = 0;
- int i = 0;
- gf_boolean_t is_hot_tier = _gf_false;
-
- if (glusterd_is_shd_compatible_type(volinfo->tier_info.cold_type)) {
- ret = glusterd_create_sub_tier_volinfo(volinfo, &dup_volinfo[0],
- is_hot_tier, volinfo->volname);
- if (ret)
- goto out;
- }
- if (glusterd_is_shd_compatible_type(volinfo->tier_info.hot_type)) {
- is_hot_tier = _gf_true;
- ret = glusterd_create_sub_tier_volinfo(volinfo, &dup_volinfo[1],
- is_hot_tier, volinfo->volname);
- if (ret)
- goto out;
- dup_volinfo[1]->tier_info.cur_tier_hot = 1;
- }
-
- for (i = 0; i < 2; i++) {
- if (!dup_volinfo[i])
- continue;
- ret = build_afr_ec_clusters(graph, dup_volinfo[i]);
- if (ret < 0)
- goto out;
- clusters += ret;
- }
- ret = 0;
-out:
- for (i = 0; i < 2; i++) {
- if (dup_volinfo[i])
- glusterd_volinfo_delete(dup_volinfo[i]);
- }
-
- if (ret)
- clusters = -1;
-
- return clusters;
-}
-
-static int
build_shd_clusters(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
dict_t *set_dict)
{
int ret = 0;
int clusters = -1;
- if (volinfo->type == GF_CLUSTER_TYPE_TIER) {
- ret = volgen_graph_build_clients_for_tier_shd(graph, volinfo, set_dict);
- if (ret)
- goto out;
+ ret = volgen_graph_build_clients(graph, volinfo, set_dict, NULL);
+ if (ret)
+ goto out;
+ clusters = build_afr_ec_clusters(graph, volinfo);
- clusters = build_afr_ec_clusters_for_tier(graph, volinfo, set_dict);
- } else {
- ret = volgen_graph_build_clients(graph, volinfo, set_dict, NULL);
- if (ret)
- goto out;
- clusters = build_afr_ec_clusters(graph, volinfo);
- }
out:
return clusters;
}
@@ -4957,16 +4792,6 @@ gd_is_self_heal_enabled(glusterd_volinfo_t *volinfo, dict_t *dict)
shd_key = volgen_get_shd_key(volinfo->type);
shd_enabled = dict_get_str_boolean(dict, shd_key, _gf_true);
break;
- case GF_CLUSTER_TYPE_TIER:
- shd_key = volgen_get_shd_key(volinfo->tier_info.cold_type);
- if (shd_key)
- shd_enabled = dict_get_str_boolean(dict, shd_key, _gf_true);
-
- shd_key = volgen_get_shd_key(volinfo->tier_info.hot_type);
- if (shd_key)
- shd_enabled |= dict_get_str_boolean(dict, shd_key, _gf_true);
-
- break;
default:
break;
}
@@ -5017,12 +4842,7 @@ build_rebalance_volfile(glusterd_volinfo_t *volinfo, char *filepath,
if (ret)
goto out;
- if (volinfo->type == GF_CLUSTER_TYPE_TIER)
- ret = volume_volgen_graph_build_clusters_tier(&graph, volinfo,
- _gf_false);
- else
- ret = volume_volgen_graph_build_clusters(&graph, volinfo, _gf_false);
-
+ ret = volume_volgen_graph_build_clusters(&graph, volinfo, _gf_false);
if (ret)
goto out;
@@ -5053,24 +4873,15 @@ out:
static int
build_shd_volume_graph(xlator_t *this, volgen_graph_t *graph,
glusterd_volinfo_t *volinfo, dict_t *mod_dict,
- dict_t *set_dict, gf_boolean_t graph_check,
- gf_boolean_t *valid_config)
+ dict_t *set_dict, gf_boolean_t graph_check)
{
volgen_graph_t cgraph = {0};
int ret = 0;
int clusters = -1;
- if (!graph_check && (volinfo->status != GLUSTERD_STATUS_STARTED))
- goto out;
-
if (!glusterd_is_shd_compatible_volume(volinfo))
goto out;
- /* Shd graph is valid only when there is at least one
- * replica/disperse volume is present
- */
- *valid_config = _gf_true;
-
ret = prepare_shd_volume_options(volinfo, mod_dict, set_dict);
if (ret)
goto out;
@@ -5100,51 +4911,43 @@ out:
}
int
-build_shd_graph(volgen_graph_t *graph, dict_t *mod_dict)
+build_shd_graph(glusterd_volinfo_t *volinfo, volgen_graph_t *graph,
+ dict_t *mod_dict)
{
- glusterd_volinfo_t *voliter = NULL;
xlator_t *this = NULL;
- glusterd_conf_t *priv = NULL;
dict_t *set_dict = NULL;
int ret = 0;
- gf_boolean_t valid_config = _gf_false;
xlator_t *iostxl = NULL;
gf_boolean_t graph_check = _gf_false;
this = THIS;
- priv = this->private;
set_dict = dict_new();
if (!set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
ret = -ENOMEM;
goto out;
}
if (mod_dict)
graph_check = dict_get_str_boolean(mod_dict, "graph-check", 0);
- iostxl = volgen_graph_add_as(graph, "debug/io-stats", "glustershd");
+ iostxl = volgen_graph_add_as(graph, "debug/io-stats", volinfo->volname);
if (!iostxl) {
ret = -1;
goto out;
}
- cds_list_for_each_entry(voliter, &priv->volumes, vol_list)
- {
- ret = build_shd_volume_graph(this, graph, voliter, mod_dict, set_dict,
- graph_check, &valid_config);
- ret = dict_reset(set_dict);
- if (ret)
- goto out;
- }
+ ret = build_shd_volume_graph(this, graph, volinfo, mod_dict, set_dict,
+ graph_check);
out:
if (set_dict)
dict_unref(set_dict);
- if (!valid_config)
- ret = -EINVAL;
return ret;
}
+#ifdef BUILD_GNFS
+
static int
volgen_graph_set_iam_nfsd(const volgen_graph_t *graph)
{
@@ -5260,25 +5063,40 @@ build_nfs_graph(volgen_graph_t *graph, dict_t *mod_dict)
ret = dict_set_sizen_str_sizen(set_dict, "performance.stat-prefetch",
"off");
- if (ret)
+ if (ret) {
+ gf_smsg("glusterd", GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=performance.stat-prefetch", NULL);
goto out;
+ }
ret = dict_set_sizen_str_sizen(set_dict,
"performance.client-io-threads", "off");
- if (ret)
+ if (ret) {
+ gf_smsg("glusterd", GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=performance.client-io-threads", NULL);
goto out;
+ }
ret = dict_set_str_sizen(set_dict, "client-transport-type", nfs_xprt);
- if (ret)
+ if (ret) {
+ gf_smsg("glusterd", GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=client-transport-type", NULL);
goto out;
+ }
ret = dict_set_uint32(set_dict, "trusted-client", GF_CLIENT_TRUSTED);
- if (ret)
+ if (ret) {
+ gf_smsg("glusterd", GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=trusted-client", NULL);
goto out;
+ }
ret = dict_set_sizen_str_sizen(set_dict, "nfs-volume-file", "yes");
- if (ret)
+ if (ret) {
+ gf_smsg("glusterd", GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=nfs-volume-file", NULL);
goto out;
+ }
if (mod_dict && (data = dict_get_sizen(mod_dict, "volume-name"))) {
volname = data->data;
@@ -5337,7 +5155,7 @@ out:
return ret;
}
-
+#endif
/****************************
*
* Volume generation interface
@@ -5520,8 +5338,11 @@ build_quotad_graph(volgen_graph_t *graph, dict_t *mod_dict)
continue;
ret = dict_set_uint32(set_dict, "trusted-client", GF_CLIENT_TRUSTED);
- if (ret)
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=trusted-client", NULL);
goto out;
+ }
dict_copy(voliter->dict, set_dict);
if (mod_dict)
@@ -5543,12 +5364,7 @@ build_quotad_graph(volgen_graph_t *graph, dict_t *mod_dict)
if (ret)
goto out;
- if (voliter->type == GF_CLUSTER_TYPE_TIER)
- ret = volume_volgen_graph_build_clusters_tier(&cgraph, voliter,
- _gf_true);
- else
- ret = volume_volgen_graph_build_clusters(&cgraph, voliter,
- _gf_true);
+ ret = volume_volgen_graph_build_clusters(&cgraph, voliter, _gf_true);
if (ret) {
ret = -1;
goto out;
@@ -5610,23 +5426,6 @@ get_parent_vol_tstamp_file(char *filename, glusterd_volinfo_t *volinfo)
}
}
-void
-assign_jbr_uuids(glusterd_volinfo_t *volinfo)
-{
- glusterd_brickinfo_t *brickinfo = NULL;
- int in_group = 0;
- uuid_t tmp_uuid;
-
- list_for_each_entry(brickinfo, &volinfo->bricks, brick_list)
- {
- if (in_group == 0)
- gf_uuid_generate(tmp_uuid);
- gf_uuid_copy(brickinfo->jbr_uuid, tmp_uuid);
- if (++in_group >= volinfo->replica_count)
- in_group = 0;
- }
-}
-
int
generate_brick_volfiles(glusterd_volinfo_t *volinfo)
{
@@ -5694,10 +5493,6 @@ generate_brick_volfiles(glusterd_volinfo_t *volinfo)
}
}
- if (glusterd_volinfo_get_boolean(volinfo, "cluster.jbr") > 0) {
- assign_jbr_uuids(volinfo);
- }
-
ret = glusterd_volume_brick_for_each(volinfo, NULL,
glusterd_generate_brick_volfile);
if (ret)
@@ -5743,14 +5538,21 @@ glusterd_generate_client_per_brick_volfile(glusterd_volinfo_t *volinfo)
int ret = -1;
char *ssl_str = NULL;
gf_boolean_t ssl_bool = _gf_false;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
dict = dict_new();
- if (!dict)
+ if (!dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
goto out;
+ }
ret = dict_set_uint32(dict, "trusted-client", GF_CLIENT_TRUSTED);
- if (ret)
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=trusted-client", NULL);
goto free_dict;
+ }
if (dict_get_str_sizen(volinfo->dict, "client.ssl", &ssl_str) == 0) {
if (gf_string2boolean(ssl_str, &ssl_bool) == 0) {
@@ -5832,17 +5634,25 @@ generate_dummy_client_volfiles(glusterd_volinfo_t *volinfo)
enumerate_transport_reqs(volinfo->transport_type, types);
dict = dict_new();
- if (!dict)
+ if (!dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
goto out;
+ }
for (i = 0; types[i]; i++) {
ret = dict_set_str(dict, "client-transport-type", types[i]);
- if (ret)
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=client-transport-type", NULL);
goto out;
+ }
type = transport_str_to_type(types[i]);
ret = dict_set_uint32(dict, "trusted-client", GF_CLIENT_OTHER);
- if (ret)
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=trusted-client", NULL);
goto out;
+ }
ret = glusterd_get_dummy_client_filepath(filepath, volinfo, type);
if (ret) {
@@ -5903,17 +5713,25 @@ generate_client_volfiles(glusterd_volinfo_t *volinfo,
enumerate_transport_reqs(volinfo->transport_type, types);
dict = dict_new();
- if (!dict)
+ if (!dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
goto out;
+ }
for (i = 0; types[i]; i++) {
ret = dict_set_str(dict, "client-transport-type", types[i]);
- if (ret)
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=client-transport-type", NULL);
goto out;
+ }
type = transport_str_to_type(types[i]);
ret = dict_set_uint32(dict, "trusted-client", client_type);
- if (ret)
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=trusted-client", NULL);
goto out;
+ }
if (client_type == GF_CLIENT_TRUSTED) {
ret = glusterd_get_trusted_client_filepath(filepath, volinfo, type);
@@ -6063,10 +5881,15 @@ prepare_bitrot_scrub_volume_options(glusterd_volinfo_t *volinfo,
dict_t *mod_dict, dict_t *set_dict)
{
int ret = 0;
+ xlator_t *this = THIS;
+ GF_ASSERT(this);
ret = dict_set_uint32(set_dict, "trusted-client", GF_CLIENT_TRUSTED);
- if (ret)
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=trusted-client", NULL);
goto out;
+ }
dict_copy(volinfo->dict, set_dict);
if (mod_dict)
@@ -6134,6 +5957,7 @@ build_bitd_volume_graph(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
set_dict = dict_new();
if (!set_dict) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
ret = -1;
goto out;
}
@@ -6458,6 +6282,10 @@ glusterd_create_volfiles(glusterd_volinfo_t *volinfo)
if (ret)
gf_log(this->name, GF_LOG_ERROR, "Could not generate gfproxy volfiles");
+ ret = glusterd_shdsvc_create_volfile(volinfo);
+ if (ret)
+ gf_log(this->name, GF_LOG_ERROR, "Could not generate shd volfiles");
+
dict_del_sizen(volinfo->dict, "skip-CLIOT");
out:
@@ -6536,9 +6364,12 @@ validate_shdopts(glusterd_volinfo_t *volinfo, dict_t *val_dict,
goto out;
}
ret = dict_set_int32_sizen(val_dict, "graph-check", 1);
- if (ret)
+ if (ret) {
+ gf_smsg("glusterd", GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ "Key=graph-check", NULL);
goto out;
- ret = build_shd_graph(&graph, val_dict);
+ }
+ ret = build_shd_graph(volinfo, &graph, val_dict);
if (!ret)
ret = graph_reconf_validateopt(&graph.graph, op_errstr);
@@ -6550,7 +6381,8 @@ out:
return ret;
}
-int
+#ifdef BUILD_GNFS
+static int
validate_nfsopts(glusterd_volinfo_t *volinfo, dict_t *val_dict,
char **op_errstr)
{
@@ -6590,6 +6422,8 @@ validate_nfsopts(glusterd_volinfo_t *volinfo, dict_t *val_dict,
"wrong transport "
"type %s",
tt);
+ gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_INCOMPATIBLE_VALUE,
+ "Type=%s", tt, NULL);
*op_errstr = gf_strdup(err_str);
ret = -1;
goto out;
@@ -6615,6 +6449,7 @@ out:
gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
+#endif
int
validate_clientopts(glusterd_volinfo_t *volinfo, dict_t *val_dict,
@@ -6657,6 +6492,7 @@ validate_brickopts(glusterd_volinfo_t *volinfo, glusterd_brickinfo_t *brickinfo,
graph.errstr = op_errstr;
full_dict = dict_new();
if (!full_dict) {
+ gf_smsg("glusterd", GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
ret = -1;
goto out;
}
@@ -6732,13 +6568,13 @@ glusterd_validate_globalopts(glusterd_volinfo_t *volinfo, dict_t *val_dict,
gf_msg_debug("glusterd", 0, "Could not Validate client");
goto out;
}
-
+#ifdef BUILD_GNFS
ret = validate_nfsopts(volinfo, val_dict, op_errstr);
if (ret) {
gf_msg_debug("glusterd", 0, "Could not Validate nfs");
goto out;
}
-
+#endif
ret = validate_shdopts(volinfo, val_dict, op_errstr);
if (ret) {
gf_msg_debug("glusterd", 0, "Could not Validate self-heald");
@@ -6788,12 +6624,13 @@ glusterd_validate_reconfopts(glusterd_volinfo_t *volinfo, dict_t *val_dict,
goto out;
}
+#ifdef BUILD_GNFS
ret = validate_nfsopts(volinfo, val_dict, op_errstr);
if (ret) {
gf_msg_debug("glusterd", 0, "Could not Validate nfs");
goto out;
}
-
+#endif
ret = validate_shdopts(volinfo, val_dict, op_errstr);
if (ret) {
gf_msg_debug("glusterd", 0, "Could not Validate self-heald");
@@ -6805,13 +6642,16 @@ out:
return ret;
}
-static struct volopt_map_entry *
-_gd_get_vmep(char *key)
+struct volopt_map_entry *
+gd_get_vmep(const char *key)
{
char *completion = NULL;
struct volopt_map_entry *vmep = NULL;
int ret = 0;
+ if (!key)
+ return NULL;
+
COMPLETE_OPTION((char *)key, completion, ret);
for (vmep = glusterd_volopt_map; vmep->key; vmep++) {
if (strcmp(vmep->key, key) == 0)
@@ -6822,13 +6662,8 @@ _gd_get_vmep(char *key)
}
uint32_t
-glusterd_get_op_version_for_key(char *key)
+glusterd_get_op_version_from_vmep(struct volopt_map_entry *vmep)
{
- struct volopt_map_entry *vmep = NULL;
-
- GF_ASSERT(key);
-
- vmep = _gd_get_vmep(key);
if (vmep)
return vmep->op_version;
@@ -6836,13 +6671,8 @@ glusterd_get_op_version_for_key(char *key)
}
gf_boolean_t
-gd_is_client_option(char *key)
+gd_is_client_option(struct volopt_map_entry *vmep)
{
- struct volopt_map_entry *vmep = NULL;
-
- GF_ASSERT(key);
-
- vmep = _gd_get_vmep(key);
if (vmep && (vmep->flags & VOLOPT_FLAG_CLIENT_OPT))
return _gf_true;
@@ -6850,23 +6680,17 @@ gd_is_client_option(char *key)
}
gf_boolean_t
-gd_is_xlator_option(char *key)
+gd_is_xlator_option(struct volopt_map_entry *vmep)
{
- struct volopt_map_entry *vmep = NULL;
-
- GF_ASSERT(key);
-
- vmep = _gd_get_vmep(key);
if (vmep && (vmep->flags & VOLOPT_FLAG_XLATOR_OPT))
return _gf_true;
return _gf_false;
}
-volume_option_type_t
-_gd_get_option_type(char *key)
+static volume_option_type_t
+_gd_get_option_type(struct volopt_map_entry *vmep)
{
- struct volopt_map_entry *vmep = NULL;
void *dl_handle = NULL;
volume_opt_list_t vol_opt_list = {
{0},
@@ -6876,10 +6700,6 @@ _gd_get_option_type(char *key)
char *xlopt_key = NULL;
volume_option_type_t opt_type = GF_OPTION_TYPE_MAX;
- GF_ASSERT(key);
-
- vmep = _gd_get_vmep(key);
-
if (vmep) {
CDS_INIT_LIST_HEAD(&vol_opt_list.list);
ret = xlator_volopt_dynload(vmep->voltype, &dl_handle, &vol_opt_list);
@@ -6906,12 +6726,29 @@ out:
}
gf_boolean_t
-gd_is_boolean_option(char *key)
+gd_is_boolean_option(struct volopt_map_entry *vmep)
{
- GF_ASSERT(key);
-
- if (GF_OPTION_TYPE_BOOL == _gd_get_option_type(key))
+ if (GF_OPTION_TYPE_BOOL == _gd_get_option_type(vmep))
return _gf_true;
return _gf_false;
}
+
+int
+glusterd_shdsvc_generate_volfile(glusterd_volinfo_t *volinfo, char *filename,
+ dict_t *mode_dict)
+{
+ int ret = -1;
+ volgen_graph_t graph = {
+ 0,
+ };
+
+ graph.type = GF_SHD;
+ ret = build_shd_graph(volinfo, &graph, mode_dict);
+ if (!ret)
+ ret = volgen_write_volfile(&graph, filename);
+
+ volgen_graph_free(&graph);
+
+ return ret;
+}