From 08c87ae4208b73f4f183f7b54ebcb373e8bc0ede Mon Sep 17 00:00:00 2001 From: Vishal Pandey Date: Wed, 24 Apr 2019 13:37:16 +0530 Subject: glusterd/thin-arbiter: Thin-arbiter integration with GD1 gluster volume create replica 2 thin-arbiter 1 : : : [force] The changes have been made in a way that the last brick in the bricks list will be treated as the thin-arbiter. GD1 will be manipulated to consider replica count to be as 2 and continue creating the volume like any other replica 2 volume but since thin-arbiter volumes need ta-brick client xlator entries for each subvolume in fuse volfile, volfile generation is modified in a way to inject these entries seperately in the volfile for every subvolume. Few more additions - 1- Save the volinfo with new fields ta_bricks list and thin_arbiter_count. 2- Introduce a new option client.ta-brick-port to add remote-port to ta-brick xlator entry in fuse volfiles. The option can be set using the following CLI syntax - gluster volume set client.ta-brick-port 3- Volume Info will contain a Thin-Arbiter-path entry to distinguish from other replicate volumes. Change-Id: Ib434e2313b29716f32476c6c211d282c4ef39406 Updates #687 Signed-off-by: Vishal Pandey (cherry picked from commit 9b223b15ab69fce4076de036ee162f36a058bcd2) --- xlators/mgmt/glusterd/src/glusterd-handler.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 576cae7b57a..a0bf409d872 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -357,6 +357,7 @@ glusterd_add_volume_detail_to_dict(glusterd_volinfo_t *volinfo, dict_t *volumes, }; int keylen; glusterd_brickinfo_t *brickinfo = NULL; + glusterd_brickinfo_t *ta_brickinfo = NULL; char *buf = NULL; int i = 1; dict_t *dict = NULL; @@ -368,6 +369,10 @@ glusterd_add_volume_detail_to_dict(glusterd_volinfo_t *volinfo, dict_t *volumes, xlator_t *this = NULL; int32_t len = 0; + char ta_brick[4096] = { + 0, + }; + GF_ASSERT(volinfo); GF_ASSERT(volumes); @@ -431,6 +436,11 @@ glusterd_add_volume_detail_to_dict(glusterd_volinfo_t *volinfo, dict_t *volumes, if (ret) goto out; + keylen = snprintf(key, sizeof(key), "volume%d.thin_arbiter_count", count); + ret = dict_set_int32n(volumes, key, keylen, volinfo->thin_arbiter_count); + if (ret) + goto out; + volume_id_str = gf_strdup(uuid_utoa(volinfo->volume_id)); if (!volume_id_str) goto out; @@ -481,6 +491,23 @@ glusterd_add_volume_detail_to_dict(glusterd_volinfo_t *volinfo, dict_t *volumes, i++; } + if (volinfo->thin_arbiter_count == 1) { + ta_brickinfo = list_first_entry(&volinfo->ta_bricks, + glusterd_brickinfo_t, brick_list); + len = snprintf(ta_brick, sizeof(ta_brick), "%s:%s", + ta_brickinfo->hostname, ta_brickinfo->path); + if ((len < 0) || (len >= sizeof(ta_brick))) { + ret = -1; + goto out; + } + buf = gf_strdup(ta_brick); + keylen = snprintf(key, sizeof(key), "volume%d.thin_arbiter_brick", + count); + ret = dict_set_dynstrn(volumes, key, keylen, buf); + if (ret) + goto out; + } + ret = glusterd_add_arbiter_info_to_bricks(volinfo, volumes, count); if (ret) goto out; -- cgit