tidyup
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user