summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-hooks.c
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2015-05-14 15:00:59 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-06-05 02:20:26 -0700
commitae87a7fedfcf7f6b287ef5c3860f45412363e4f6 (patch)
tree967ea9f74debc940a5729aa8cd858867bbd9eba4 /xlators/mgmt/glusterd/src/glusterd-hooks.c
parentbedda7c258e000d94b09599340400955e4b8079f (diff)
glusterd/shared_storage: Provide a volume set option to create and mount the shared storage
Backport of http://review.gluster.org/#/c/10793/ Introducing a global volume set option(cluster.enable-shared-storage) which helps create and set-up the shared storage meta volume. gluster volume set all cluster.enable-shared-storage enable On enabling this option, the system analyzes the number of peers in the cluster, which are currently connected, and chooses three such peers(including the node the command is issued from). From these peers a volume(gluster_shared_storage) is created. Depending on the number of peers available the volume is either a replica 3 volume(if there are 3 connected peers), or a replica 2 volume(if there are 2 connected peers). "/var/run/gluster/ss_brick" serves as the brick path on each node for the shared storage volume. We also mount the shared storage at "/var/run/gluster/shared_storage" on all the nodes in the cluster as part of enabling this option. If there is only one node in the cluster, or only one node is up then the command will fail Once the volume is created, and mounted the maintainance of the volume like adding-bricks, removing bricks etc., is expected to be the onus of the user. On disabling the option, we provide the user a warning, and on affirmation from the user we stop the shared storage volume, and unmount it from all the nodes in the cluster. gluster volume set all cluster.enable-shared-storage disable Change-Id: Idd92d67b93f444244f99ede9f634ef18d2945dbc BUG: 1228181 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/11086 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-hooks.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-hooks.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-hooks.c b/xlators/mgmt/glusterd/src/glusterd-hooks.c
index 569f2743dda..3e3f18959b0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-hooks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-hooks.c
@@ -162,6 +162,34 @@ glusterd_hooks_add_hooks_version (runner_t* runner)
runner_argprintf (runner, "--version=%d", GLUSTERD_HOOK_VER);
}
+static void
+glusterd_hooks_add_custom_args (dict_t *dict, runner_t *runner)
+{
+ char *hooks_args = NULL;
+ int32_t ret = -1;
+ xlator_t *this = NULL;
+
+ this = THIS;
+ GF_VALIDATE_OR_GOTO ("glusterd", this, out);
+ GF_VALIDATE_OR_GOTO (this->name, dict, out);
+ GF_VALIDATE_OR_GOTO (this->name, runner, out);
+
+ ret = dict_get_str (dict, "hooks_args", &hooks_args);
+ if (ret)
+ gf_log (this->name, GF_LOG_DEBUG,
+ "No Hooks Arguments.");
+ else
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Hooks Args = %s", hooks_args);
+
+ if (hooks_args)
+ runner_argprintf (runner, "%s", hooks_args);
+
+out:
+ return;
+}
+
+
int
glusterd_hooks_set_volume_args (dict_t *dict, runner_t *runner)
{
@@ -196,6 +224,8 @@ glusterd_hooks_set_volume_args (dict_t *dict, runner_t *runner)
runner_argprintf (runner, "%s=%s", key, value);
}
+ glusterd_hooks_add_custom_args (dict, runner);
+
ret = 0;
out:
return ret;
@@ -263,15 +293,7 @@ glusterd_hooks_add_op_args (runner_t *runner, glusterd_op_t op,
break;
case GD_OP_GSYNC_CREATE:
- ret = dict_get_str (op_ctx, "hooks_args", &hooks_args);
- if (ret)
- gf_log ("", GF_LOG_DEBUG,
- "No Hooks Arguments.");
- else
- gf_log ("", GF_LOG_DEBUG,
- "Hooks Args = %s", hooks_args);
- if (hooks_args)
- runner_argprintf (runner, "%s", hooks_args);
+ glusterd_hooks_add_custom_args (op_ctx, runner);
break;
case GD_OP_ADD_BRICK: