summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2010-11-03 05:29:49 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-11-03 04:25:41 -0700
commit0fbf226cdeb970f4b5829f92c6d27523f3ef4f04 (patch)
treed673ef950e3b24ee619455972118095cf35ef83a /xlators/mgmt
parentba1d55c083a39f56077305037de0b619316b2717 (diff)
mgmt/Glusterd: add nfs.enable-ino32 as an option to set from CLI
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1972 (xcs get doesn't work with gNFS) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1972
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c106
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h1
2 files changed, 106 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index e27eb56cc..158a49654 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -135,6 +135,8 @@ static struct volopt_map_entry glusterd_volopt_map[] = {
{"performance.quick-read", "performance/quick-read", "!perf", "on"}, /* NODOC */
{"performance.stat-prefetch", "performance/stat-prefetch", "!perf",}, /* NODOC */
+ {"nfs.enable-ino32", "nfs.enable-ino32", "nfs.enable-ino32",},
+
{NULL, }
};
@@ -1231,6 +1233,75 @@ build_client_graph (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo,
&client_graph_builder);
}
+static int
+build_nfs_validation_graph (glusterfs_graph_t *graph, dict_t *dict)
+{
+ glusterfs_graph_t cgraph = {{0,},};
+ glusterd_volinfo_t *voliter = NULL;
+ xlator_t *this = NULL;
+ glusterd_conf_t *priv = NULL;
+ xlator_t *nfsxl = NULL;
+ char *skey = NULL;
+ char volume_id[64] = {0,};
+ int ret = 0;
+ data_t *data = NULL;
+
+ this = THIS;
+ GF_ASSERT (this);
+ priv = this->private;
+ GF_ASSERT (priv);
+
+ nfsxl = volgen_graph_add_as (graph, "nfs/server", "nfs-server");
+ if (!nfsxl)
+ return -1;
+ ret = xlator_set_option (nfsxl, "nfs.dynamic-volumes", "on");
+ if (ret)
+ return -1;
+
+ list_for_each_entry (voliter, &priv->volumes, vol_list) {
+ ret = gf_asprintf (&skey, "rpc-auth.addr.%s.allow",
+ voliter->volname);
+ if (ret == -1)
+ goto oom;
+ ret = xlator_set_option (nfsxl, skey, "*");
+ GF_FREE (skey);
+ if (ret)
+ return -1;
+
+ ret = gf_asprintf (&skey, "nfs3.%s.volume-id",
+ voliter->volname);
+ if (ret == -1)
+ goto oom;
+ uuid_unparse (voliter->volume_id, volume_id);
+ ret = xlator_set_option (nfsxl, skey, volume_id);
+ GF_FREE (skey);
+ if (ret)
+ return -1;
+
+ data = dict_get (dict, "nfs.enable-ino32");
+ if (data) {
+ ret = xlator_set_option (nfsxl,
+ "nfs.enable-ino32",
+ data->data);
+ if (ret)
+ return -1;
+ }
+
+ memset (&cgraph, 0, sizeof (cgraph));
+ ret = build_client_graph (&cgraph, voliter, NULL);
+ if (ret)
+ return -1;
+ ret = volgen_graph_merge_sub (graph, &cgraph);
+ }
+
+ return ret;
+
+ oom:
+ gf_log ("", GF_LOG_ERROR, "Out of memory");
+
+ return -1;
+
+}
/* builds a graph for nfs server role */
static int
@@ -1244,6 +1315,7 @@ build_nfs_graph (glusterfs_graph_t *graph)
char *skey = NULL;
char volume_id[64] = {0,};
int ret = 0;
+ data_t *data = NULL;
this = THIS;
GF_ASSERT (this);
@@ -1257,6 +1329,7 @@ build_nfs_graph (glusterfs_graph_t *graph)
if (ret)
return -1;
+
list_for_each_entry (voliter, &priv->volumes, vol_list) {
if (voliter->status != GLUSTERD_STATUS_STARTED)
continue;
@@ -1280,6 +1353,17 @@ build_nfs_graph (glusterfs_graph_t *graph)
if (ret)
return -1;
+ data = dict_get (voliter->dict, "nfs.enable-ino32");
+ if (data) {
+ if (!dict_get (nfsxl->options, "nfs.enable-ino32")) {
+ ret = xlator_set_option (nfsxl,
+ "nfs.enable-ino32",
+ data->data);
+ if (ret)
+ return -1;
+ }
+ }
+
memset (&cgraph, 0, sizeof (cgraph));
ret = build_client_graph (&cgraph, voliter, NULL);
if (ret)
@@ -1487,6 +1571,26 @@ glusterd_delete_volfile (glusterd_volinfo_t *volinfo,
}
int
+validate_nfsopts (glusterd_volinfo_t *volinfo,
+ dict_t *val_dict,
+ char **op_errstr)
+{
+ glusterfs_graph_t graph = {{0,},};
+ int ret = -1;
+
+ GF_ASSERT (volinfo);
+
+ ret = build_nfs_validation_graph (&graph, val_dict);
+ if (!ret)
+ ret = graph_reconf_validateopt (&graph, op_errstr);
+
+ volgen_graph_free (&graph);
+
+ gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);
+ return ret;
+}
+
+int
validate_clientopts (glusterd_volinfo_t *volinfo,
dict_t *val_dict,
char **op_errstr)
@@ -1577,6 +1681,8 @@ glusterd_validate_reconfopts (glusterd_volinfo_t *volinfo, dict_t *val_dict,
goto out;
}
+ ret = validate_nfsopts (volinfo, val_dict, op_errstr);
+
out:
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 185d36225..8853db813 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -188,7 +188,6 @@ struct glusterd_volinfo_ {
uint32_t cksum;
gf_transport_type transport_type;
- /* All xlator options */
dict_t *dict;
uuid_t volume_id;