From eebd4e14853b1660ccf520f4ee34729d2b118878 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Wed, 28 Aug 2013 01:33:11 +0530 Subject: geo-replication: fix the logic of choosing the remote node to sync Change-Id: Ie15636357d89e94b6bfad0e168b1fcad53508c47 BUG: 1003807 Signed-off-by: Amar Tumballi Signed-off-by: Venky Shankar Reviewed-on: http://review.gluster.org/5759 Tested-by: Gluster Build System Reviewed-by: Avra Sengupta Tested-by: Avra Sengupta Reviewed-by: Anand Avati --- geo-replication/syncdaemon/monitor.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'geo-replication') diff --git a/geo-replication/syncdaemon/monitor.py b/geo-replication/syncdaemon/monitor.py index 23655257..ca7dd055 100644 --- a/geo-replication/syncdaemon/monitor.py +++ b/geo-replication/syncdaemon/monitor.py @@ -248,11 +248,20 @@ def distribute(*resources): slaves = [ 'ssh://' + rap.remote_addr + ':' + v for v in slavevols ] else: slaves = slavevols + + # get the proper index of local bricks in master volume, + # and setup the geo replication with appropriate slave node + mbricks = [ b['dir'] for b in mvol.bricks ] + mbricks.sort() locmbricks.sort() slaves.sort() workerspex = [] - for i in range(len(locmbricks)): - workerspex.append((locmbricks[i], slaves[i % len(slaves)])) + + locbidx = 0 + for idx, brick in enumerate(mbricks): + if brick == locmbricks[locbidx]: + workerspex.append((locmbricks[locbidx], slaves[idx % len(slaves)])) + locbidx += 1 logging.info('worker specs: ' + repr(workerspex)) return workerspex, suuid -- cgit