From 32ed7aa5ad7049a9d85c795f997336c0366151a8 Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Thu, 19 Mar 2015 12:33:51 +0000 Subject: afr: arbiter xlator This patch adds the arbiter translator into the tree. This is a server side xlator used for replica 3 volumes. It sits above posix and will be loaded on the 3rd (last) brick of every afr subvolume in a replica 3 configuration. It intercepts inode read/write operations: reads are unwound with ENOTCONN, inode writes are unwound with success without actually passing them down to posix. Metadata operations are allowed to pass through. The CLI for creating a 3 way replica with arbiter is also added but kept disabled (A 'normal' 3 way replica is created instead). This patch is a part of the arbiter logic implementation for 3 way AFR, details of which can be found at http://review.gluster.org/#/c/9656/ Change-Id: I395b81f49d5da52c466daf5c8518f1bbad9c16fa BUG: 1199985 Signed-off-by: Ravishankar N Reviewed-on: http://review.gluster.org/9840 Tested-by: Gluster Build System Reviewed-by: Pranith Kumar Karampuri Reviewed-by: Vijay Bellur --- cli/src/cli-cmd-parser.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'cli/src/cli-cmd-parser.c') diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 54a5700845..0584b1edbb 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -437,12 +437,13 @@ cli_cmd_volume_create_parse (struct cli_state *state, const char **words, char *bricks = NULL; int32_t brick_count = 0; char *opwords[] = { "replica", "stripe", "transport", "disperse", - "redundancy", "disperse-data", NULL }; + "redundancy", "disperse-data", "arbiter", NULL }; char *w = NULL; char *ptr = NULL; int op_count = 0; int32_t replica_count = 1; + int32_t arbiter_count = 0; int32_t stripe_count = 1; int32_t disperse_count = -1; int32_t redundancy_count = -1; @@ -521,6 +522,25 @@ cli_cmd_volume_create_parse (struct cli_state *state, const char **words, goto out; index += 2; + if (!strcmp (words[index], "arbiter")) { + ret = gf_string2int (words[index+1], + &arbiter_count); + if (ret == -1 || arbiter_count != 1 || + replica_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 += 2; + } } else if ((strcmp (w, "stripe")) == 0) { switch (type) { -- cgit