summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorMeghana M <mmadhusu@redhat.com>2014-03-24 13:58:38 +0530
committerVijay Bellur <vbellur@redhat.com>2014-05-03 07:24:07 -0700
commit0088e318c1218191535ea0baa04b4fe858412f54 (patch)
tree4ddcb20318affb12ae2470c4191805c1f4745141 /xlators/mgmt/glusterd
parent66f560e0071db84d430f38b996364f6b8c4f0f6d (diff)
cli/hooks : Add volume set options to enable/disable nfs-ganesha support.
1. gluster volume set nfs-ganesha.enable ON/OFF If the option is set to ON, the volume field in the nfs-ganesha configuartion file is edited. Gluster-nfs is disabled on that volume and the volume is exported using nfs-ganesha. 2.gluster volume set nfs-ganesha.host IP This is used to provide the IP of the nfs-ganesha host. Note : nfs-ganesha.host MUST be set before using nfs-ganesha.enable ON The switch from gluster-nfs to nfs-ganesha is mostly done by the hook-scripts in the post phase of the 'set' option. As a result, gluster volume reset does not function as it is expected to. By default, nfs-ganesha will be set to off but the process will not be killed. Hence, a few changes have to be made post 'reset' option as well. Those changes also have been added. Change-Id: I7fdc14ee49d1724af96eda33c6a3ec08b1020788 BUG: 1092283 Signed-off-by: Meghana <mmadhusu@redhat.com> Reviewed-on: http://review.gluster.org/7321 Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-by: Santosh Pradhan <spradhan@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-hooks.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c28
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c10
3 files changed, 46 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-hooks.c b/xlators/mgmt/glusterd/src/glusterd-hooks.c
index 78730a5645f..a845f540afa 100644
--- a/xlators/mgmt/glusterd/src/glusterd-hooks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-hooks.c
@@ -46,7 +46,7 @@ char glusterd_hook_dirnames[GD_OP_MAX][256] =
[GD_OP_REMOVE_BRICK] = "remove-brick",
[GD_OP_REPLACE_BRICK] = EMPTY,
[GD_OP_SET_VOLUME] = "set",
- [GD_OP_RESET_VOLUME] = EMPTY,
+ [GD_OP_RESET_VOLUME] = "reset",
[GD_OP_SYNC_VOLUME] = EMPTY,
[GD_OP_LOG_ROTATE] = EMPTY,
[GD_OP_GSYNC_CREATE] = "gsync-create",
@@ -277,6 +277,13 @@ glusterd_hooks_add_op_args (runner_t *runner, glusterd_op_t op,
glusterd_hooks_add_hooks_version (runner);
glusterd_hooks_add_op (runner, "add-brick");
glusterd_hooks_add_working_dir (runner, priv);
+ break;
+
+ case GD_OP_RESET_VOLUME:
+ glusterd_hooks_add_hooks_version (runner);
+ glusterd_hooks_add_op (runner, "reset");
+ glusterd_hooks_add_working_dir (runner, priv);
+ break;
default:
break;
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index ecc8f7cafe6..82ff8826843 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -3057,6 +3057,34 @@ nfs_option_handler (volgen_graph_t *graph,
return -1;
}
+ if (! strcmp (vme->option, "!nfs-ganesha.enable")) {
+ ret = gf_asprintf (&aa, "nfs-ganesha.%s.enable",
+ volinfo->volname);
+
+ if (ret != -1) {
+ ret = xlator_set_option (xl, aa, vme->value);
+ GF_FREE (aa);
+ }
+
+ if (ret)
+ return -1;
+ }
+
+ if (! strcmp (vme->option, "!nfs-ganesha.host")) {
+ ret = gf_asprintf (&aa, "nfs-ganesha.%s.host",
+ volinfo->volname);
+
+ if (ret != -1) {
+ ret = xlator_set_option (xl, aa, vme->value);
+ GF_FREE (aa);
+ }
+
+ if (ret)
+ return -1;
+ }
+
+
+
if ( (strcmp (vme->voltype, "nfs/server") == 0) &&
(vme->option && vme->option[0]!='!') ) {
ret = xlator_set_option (xl, vme->option, vme->value);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 8998d8478d0..b8eb8a56582 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -1392,6 +1392,16 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.option = "!nfs-disable",
.op_version = 1
},
+ { .key = "nfs-ganesha.enable",
+ .voltype = "nfs/server",
+ .option = "!nfs-ganesha.enable",
+ .op_version = 4
+ },
+ { .key = "nfs-ganesha.host",
+ .voltype = "nfs/server",
+ .option = "!nfs-ganesha.host",
+ .op_version = 4
+ },
{ .key = "nfs.nlm",
.voltype = "nfs/server",
.option = "nfs.nlm",