summaryrefslogtreecommitdiffstats
path: root/geo-replication/syncdaemon
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2013-08-29 22:57:44 +0530
committerAnand Avati <avati@redhat.com>2013-09-04 20:55:49 -0700
commit85c2b2de12e98a8cce34277541df8c5c511e7231 (patch)
treee4a71ec8d27eee885a7c7c41968835b0bb599bb3 /geo-replication/syncdaemon
parent717d2db0c0df5844cbc7ce99c8ec7457f24d8e0c (diff)
gsyncd / geo-rep: distributify slave
commit fbb8fd92 introduced slave distributification but had some problems (monitor would crash upon gsyncd start). This patch fixes the issue and makes code more pythonic ;) Change-Id: I2cbf5669d81966046a4aeeb4a6ad11a947aa8f09 BUG: 1003807 Signed-off-by: Venky Shankar <vshankar@redhat.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Tested-by: Amar Tumballi <amarts@redhat.com> Reviewed-on: http://review.gluster.org/5761 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/syncdaemon')
-rw-r--r--geo-replication/syncdaemon/monitor.py15
1 files changed, 1 insertions, 14 deletions
diff --git a/geo-replication/syncdaemon/monitor.py b/geo-replication/syncdaemon/monitor.py
index ca7dd055d4b..f6c79753d35 100644
--- a/geo-replication/syncdaemon/monitor.py
+++ b/geo-replication/syncdaemon/monitor.py
@@ -218,7 +218,6 @@ def distribute(*resources):
master, slave = resources
mvol = Volinfo(master.volume, master.host)
logging.debug('master bricks: ' + repr(mvol.bricks))
- locmbricks = [ b['dir'] for b in mvol.bricks if is_host_local(b['host']) ]
prelude = []
si = slave
if isinstance(slave, SSH):
@@ -249,19 +248,7 @@ def distribute(*resources):
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 = []
-
- locbidx = 0
- for idx, brick in enumerate(mbricks):
- if brick == locmbricks[locbidx]:
- workerspex.append((locmbricks[locbidx], slaves[idx % len(slaves)]))
- locbidx += 1
+ workerspex = [ (brick['dir'], slaves[idx % len(slaves)]) for idx, brick in enumerate(mvol.bricks) if is_host_local(brick['host']) ]
logging.info('worker specs: ' + repr(workerspex))
return workerspex, suuid