summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2014-03-25 16:48:37 +0000
committerJeff Darcy <jdarcy@redhat.com>2014-03-25 16:48:37 +0000
commit927483b6fbf2a8e731f9e34dd70dc4179accc079 (patch)
tree4beef24ea3fdeeb402b8b7ff1874e79a09a5bbcc /xlators/mgmt
parentefbb23837761bda6c526baca1b5ea72d227e2ae3 (diff)
nsr: use different etcd keys for each NSR subvolume
This is necessary both for separate volumes using NSR and for DHT volumes composed of multiple NSR subvolumes. Change-Id: Ia269d70b535cc26900f8b6e7f22706087746fbe7 Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h3
2 files changed, 18 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index aee655733..8a94309ed 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1431,9 +1431,14 @@ assign_groups (glusterd_volinfo_t *volinfo)
glusterd_brickinfo_t *brickinfo = NULL;
uint16_t group_num = 0;
int in_group = 0;
+ uuid_t tmp_uuid;
list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ if (in_group == 0) {
+ uuid_generate(tmp_uuid);
+ }
brickinfo->group = group_num;
+ uuid_copy(brickinfo->nsr_uuid,tmp_uuid);
if (++in_group >= volinfo->replica_count) {
in_group = 0;
++group_num;
@@ -1469,7 +1474,6 @@ add_nsr_stuff (volgen_graph_t *graph, char *volname,
gf_boolean_t enable_recon = _gf_false;
static uint32_t nsr_port = 27000;
-
if (glusterd_volinfo_get_boolean(volinfo,"cluster.nsr.recon") > 0) {
enable_recon = _gf_true;
}
@@ -1520,6 +1524,10 @@ add_nsr_stuff (volgen_graph_t *graph, char *volname,
return -1;
if (xlator_set_option(me,"leader",leader_opt))
return -1;
+ if (xlator_set_option(me,"subvol-uuid",
+ uuid_utoa(brickinfo->nsr_uuid))) {
+ return -1;
+ }
#define FILL_REMOTE_NAMES { \
strcat(remote_names, \
@@ -1586,7 +1594,7 @@ add_nsr_stuff (volgen_graph_t *graph, char *volname,
if (enable_recon == _gf_false)
return 0;
- /* Now fill in the various files required for reeconciliation */
+ /* Now fill in the various files required for reconciliation */
snprintf (filepath, PATH_MAX,
"%s-nsr-recon.vol",
dst);
@@ -1898,8 +1906,8 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
/* TBD: conditionalize on NSR being enabled */
if (glusterd_volinfo_get_boolean(volinfo,"cluster.nsr") > 0) {
- assign_groups(volinfo);
- ret = add_nsr_stuff (graph, volname, brickinfo, volinfo, changelog_basepath);
+ ret = add_nsr_stuff (graph, volname, brickinfo, volinfo,
+ changelog_basepath);
if (ret) {
return -1;
}
@@ -3774,6 +3782,10 @@ generate_brick_volfiles (glusterd_volinfo_t *volinfo)
}
}
+ if (glusterd_volinfo_get_boolean(volinfo,"cluster.nsr") > 0) {
+ assign_groups(volinfo);
+ }
+
list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
gf_log ("", GF_LOG_DEBUG,
"Found a brick - %s:%s", brickinfo->hostname,
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 2b9e0787d..3d810ed97 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -198,7 +198,8 @@ struct glusterd_brickinfo {
* more efficient too, though it would require some further adaptation
* to support more than one layer of hierarchy.
*/
- uint16_t group;
+ uint16_t group;
+ uuid_t nsr_uuid;
};
typedef struct glusterd_brickinfo glusterd_brickinfo_t;