summaryrefslogtreecommitdiffstats
path: root/geo-replication
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2013-08-28 01:33:11 +0530
committerAnand Avati <avati@redhat.com>2013-09-04 20:54:57 -0700
commiteebd4e14853b1660ccf520f4ee34729d2b118878 (patch)
treec7ae5e29a82c5a641c390e82325f0fb8e9684407 /geo-replication
parentb2e8a4517d63100e9527a1995ef24507192fc363 (diff)
geo-replication: fix the logic of choosing the remote node to sync
Change-Id: Ie15636357d89e94b6bfad0e168b1fcad53508c47 BUG: 1003807 Signed-off-by: Amar Tumballi <amarts@redhat.com> Signed-off-by: Venky Shankar <vshankar@redhat.com> Reviewed-on: http://review.gluster.org/5759 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com> Tested-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'geo-replication')
-rw-r--r--geo-replication/syncdaemon/monitor.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/geo-replication/syncdaemon/monitor.py b/geo-replication/syncdaemon/monitor.py
index 23655257bd4..ca7dd055d4b 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