This commit is contained in:
Edward Hope-Morley
2014-10-21 09:32:52 +01:00
parent 2ebe3cf4d5
commit eda91a0753
2 changed files with 13 additions and 14 deletions

View File

@@ -201,12 +201,6 @@ def storage_changed():
if cluster.is_elected_leader(SWIFT_HA_RES):
log("Leader established, updating ring builders")
# Notify peers that builders are available
for rid in relation_ids('cluster'):
log("Setting builder-broker addr for rid '%s'" % (rid))
relation_set(relation_id=rid,
relation_settings={'builder-broker': get_hostaddr()})
zone = get_zone(config('zone-assignment'))
node_settings = {
'ip': host_ip,
@@ -235,6 +229,12 @@ def storage_changed():
if should_balance([r for r in SWIFT_RINGS.itervalues()]):
balance_rings()
# Notify peers that builders are available
for rid in relation_ids('cluster'):
log("Notifying peer that ring builder is ready (rid='%s')" % (rid))
relation_set(relation_id=rid,
relation_settings={'builder-broker': get_hostaddr()})
else:
log("New storage relation joined - stopping proxy until ring builder "
"synced")

View File

@@ -349,16 +349,15 @@ def balance_ring(ring_path):
def should_balance(rings):
'''Based on zones vs min. replicas, determine whether or not the rings
should be balanaced during initial configuration.'''
do_rebalance = True
should be balanced during initial configuration.'''
for ring in rings:
zones = []
r = _load_builder(ring).to_dict()
replicas = r['replicas']
zones = [d['zone'] for d in r['devs']]
builder = _load_builder(ring).to_dict()
replicas = builder['replicas']
zones = [dev['zone'] for dev in builder['devs']]
if len(set(zones)) < replicas:
do_rebalance = False
return do_rebalance
return False
return True
def do_openstack_upgrade(configs):