summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2013-07-24 14:49:58 -0700
committerAnand Avati <avati@redhat.com>2013-08-03 23:47:04 -0700
commit71d69e4331d7abff910e1f013bb7b2cb9d7f630c (patch)
tree9af803115cac04fc02ca418b2bc323503c2b4151 /xlators/mgmt/glusterd/src
parented67d15fe174617c013078c37c4c87fdb119c2a4 (diff)
Add switch and nufa options to 'gluster cli'
Change-Id: Ic3c43291e0e1ead0d89c0436e8d70aa5dee2f543 BUG: 924488 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-on: http://review.gluster.org/5391 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c33
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c37
2 files changed, 53 insertions, 17 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index d849f31b1..06a2d37d5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -2316,22 +2316,33 @@ volgen_graph_build_dht_cluster (volgen_graph_t *graph,
int ret = -1;
char *decommissioned_children = NULL;
xlator_t *dht = NULL;
- char *optstr = NULL;
- gf_boolean_t use_nufa = _gf_false;
+ char *voltype = "cluster/distribute";
- if (dict_get_str(volinfo->dict,"cluster.nufa",&optstr) == 0) {
- /* Keep static analyzers quiet by "using" the value. */
- ret = gf_string2boolean(optstr,&use_nufa);
+ /* NUFA and Switch section */
+ if (dict_get_str_boolean (volinfo->dict, "cluster.nufa", 0) &&
+ dict_get_str_boolean (volinfo->dict, "cluster.switch", 0)) {
+ gf_log (THIS->name, GF_LOG_ERROR,
+ "nufa and switch cannot be set together");
+ ret = -1;
+ goto out;
}
+ /* Check for NUFA volume option, and change the voltype */
+ if (dict_get_str_boolean (volinfo->dict, "cluster.nufa", 0))
+ voltype = "cluster/nufa";
+
+ /* Check for switch volume option, and change the voltype */
+ if (dict_get_str_boolean (volinfo->dict, "cluster.switch", 0))
+ voltype = "cluster/switch";
+
clusters = volgen_graph_build_clusters (graph, volinfo,
- use_nufa
- ? "cluster/nufa"
- : "cluster/distribute",
+ voltype,
"%s-dht",
- child_count, child_count);
+ child_count,
+ child_count);
if (clusters < 0)
goto out;
+
dht = first_of (graph);
ret = _graph_get_decommissioned_children (dht, volinfo,
&decommissioned_children);
@@ -2425,7 +2436,7 @@ build_distribute:
ret = volgen_graph_build_dht_cluster (graph, volinfo,
dist_count);
- if (ret)
+ if (ret == -1)
goto out;
ret = 0;
@@ -2448,7 +2459,7 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
goto out;
ret = volume_volgen_graph_build_clusters (graph, volinfo);
- if (ret)
+ if (ret == -1)
goto out;
ret = glusterd_volinfo_get_boolean (volinfo, VKEY_FEATURES_QUOTA);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 245b29af9..b6dd09a6e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -379,6 +379,27 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.op_version = 1,
.flags = OPT_FLAG_CLIENT_OPT
},
+ { .key = "cluster.rsync-hash-regex",
+ .voltype = "cluster/distribute",
+ .type = NO_DOC,
+ .op_version = 3,
+ .flags = OPT_FLAG_CLIENT_OPT
+ },
+ { .key = "cluster.extra-hash-regex",
+ .voltype = "cluster/distribute",
+ .type = NO_DOC,
+ .op_version = 3,
+ .flags = OPT_FLAG_CLIENT_OPT
+ },
+ { .key = "cluster.dht-xattr-name",
+ .voltype = "cluster/distribute",
+ .option = "xattr-name",
+ .type = NO_DOC,
+ .op_version = 3,
+ .flags = OPT_FLAG_CLIENT_OPT
+ },
+
+ /* NUFA xlator options (Distribute special case) */
{ .key = "cluster.nufa",
.voltype = "cluster/distribute",
.option = "!nufa",
@@ -386,21 +407,25 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.op_version = 2,
.flags = OPT_FLAG_CLIENT_OPT
},
- { .key = "cluster.rsync-hash-regex",
- .voltype = "cluster/distribute",
+ { .key = "cluster.local-volume-name",
+ .voltype = "cluster/nufa",
+ .option = "local-volume-name",
.type = NO_DOC,
.op_version = 3,
.flags = OPT_FLAG_CLIENT_OPT
},
- { .key = "cluster.extra-hash-regex",
+
+ /* Switch xlator options (Distribute special case) */
+ { .key = "cluster.switch",
.voltype = "cluster/distribute",
+ .option = "!switch",
.type = NO_DOC,
.op_version = 3,
.flags = OPT_FLAG_CLIENT_OPT
},
- { .key = "cluster.dht-xattr-name",
- .voltype = "cluster/distribute",
- .option = "xattr-name",
+ { .key = "cluster.switch-pattern",
+ .voltype = "cluster/switch",
+ .option = "pattern.switch.case",
.type = NO_DOC,
.op_version = 3,
.flags = OPT_FLAG_CLIENT_OPT