From 85c2b2de12e98a8cce34277541df8c5c511e7231 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Thu, 29 Aug 2013 22:57:44 +0530 Subject: 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 Reviewed-by: Amar Tumballi Tested-by: Amar Tumballi Reviewed-on: http://review.gluster.org/5761 Tested-by: Gluster Build System Reviewed-by: Avra Sengupta Tested-by: Avra Sengupta Reviewed-by: Anand Avati --- geo-replication/syncdaemon/monitor.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'geo-replication/syncdaemon/monitor.py') diff --git a/geo-replication/syncdaemon/monitor.py b/geo-replication/syncdaemon/monitor.py index ca7dd055..f6c79753 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 -- cgit