summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2016-04-29 17:41:18 +0530
committerNiels de Vos <ndevos@redhat.com>2016-05-24 01:35:57 -0700
commitade1d726e035eea4540894b03c82b84304bba2ae (patch)
tree95a820babd8520a95b0a2ef9520d9df6f9de1889 /cli
parent125c2f6d06dfeace7469adf3e5d7be98dd34d3c3 (diff)
cli/glusterd: add/remove brick fixes for arbiter volumes
Backport of: http://review.gluster.org/14126 1.Provide a command to convert replica 2 volumes to arbiter volumes. Existing self-heal logic will automatically heal the file hierarchy into the arbiter brick, the progress of which can be monitored using the heal info command. Syntax: gluster volume add-brick <VOLNAME> replica 3 arbiter 1 <HOST:arbiter-brick-path> 2. Add checks when removing bricks from arbiter volumes: - When converting from arbiter to replica 2 volume, allow only arbiter brick to be removed. - When converting from arbiter to plain distribute volume, allow only if arbiter is one of the bricks that is removed. 3. Some clean-up: - Use GD_MSG_DICT_GET_SUCCESS instead of GD_MSG_DICT_GET_FAILED to log messages that are not failures. - Remove unused variable `brick_list` - Move 'brickinfo->group' related functions to glusted-utils. Change-Id: Ifa75d137c67ffddde7dcb8e0df0873163e713119 BUG: 1337387 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/14502 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c17
-rw-r--r--cli/src/cli-cmd-volume.c3
2 files changed, 19 insertions, 1 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 6b2d6dfe7da..b062adfab0f 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1583,6 +1583,7 @@ cli_cmd_volume_add_brick_parse (const char **words, int wordcount,
char *opwords_cl[] = { "replica", "stripe", NULL };
gf1_cluster_type type = GF_CLUSTER_TYPE_NONE;
int count = 1;
+ int arbiter_count = 0;
char *w = NULL;
int index;
gf_boolean_t is_force = _gf_false;
@@ -1635,6 +1636,22 @@ cli_cmd_volume_add_brick_parse (const char **words, int wordcount,
if (ret)
goto out;
index = 5;
+ if (words[index] && !strcmp (words[index], "arbiter")) {
+ arbiter_count = strtol (words[6], NULL, 0);
+ if (arbiter_count != 1 || count != 3) {
+ cli_err ("For arbiter configuration, replica "
+ "count must be 3 and arbiter count "
+ "must be 1. The 3rd brick of the "
+ "replica will be the arbiter");
+ ret = -1;
+ goto out;
+ }
+ ret = dict_set_int32 (dict, "arbiter-count",
+ arbiter_count);
+ if (ret)
+ goto out;
+ index = 7;
+ }
} else if ((strcmp (w, "stripe")) == 0) {
type = GF_CLUSTER_TYPE_STRIPE;
count = strtol (words[4], NULL, 0);
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index bc4f42c5967..689eba6d281 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -2586,7 +2586,8 @@ struct cli_cmd volume_cmds[] = {
"{start|stop|commit} [force]"},
#endif
- { "volume add-brick <VOLNAME> [<stripe|replica> <COUNT>] <NEW-BRICK> ... [force]",
+ { "volume add-brick <VOLNAME> [<stripe|replica> <COUNT> "
+ "[arbiter <COUNT>]] <NEW-BRICK> ... [force]",
cli_cmd_volume_add_brick_cbk,
"add brick to volume <VOLNAME>"},