tidyup
This commit is contained in:
@@ -201,12 +201,6 @@ def storage_changed():
|
|||||||
if cluster.is_elected_leader(SWIFT_HA_RES):
|
if cluster.is_elected_leader(SWIFT_HA_RES):
|
||||||
log("Leader established, updating ring builders")
|
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'))
|
zone = get_zone(config('zone-assignment'))
|
||||||
node_settings = {
|
node_settings = {
|
||||||
'ip': host_ip,
|
'ip': host_ip,
|
||||||
@@ -235,6 +229,12 @@ def storage_changed():
|
|||||||
|
|
||||||
if should_balance([r for r in SWIFT_RINGS.itervalues()]):
|
if should_balance([r for r in SWIFT_RINGS.itervalues()]):
|
||||||
balance_rings()
|
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:
|
else:
|
||||||
log("New storage relation joined - stopping proxy until ring builder "
|
log("New storage relation joined - stopping proxy until ring builder "
|
||||||
"synced")
|
"synced")
|
||||||
|
|||||||
@@ -349,16 +349,15 @@ def balance_ring(ring_path):
|
|||||||
|
|
||||||
def should_balance(rings):
|
def should_balance(rings):
|
||||||
'''Based on zones vs min. replicas, determine whether or not the rings
|
'''Based on zones vs min. replicas, determine whether or not the rings
|
||||||
should be balanaced during initial configuration.'''
|
should be balanced during initial configuration.'''
|
||||||
do_rebalance = True
|
|
||||||
for ring in rings:
|
for ring in rings:
|
||||||
zones = []
|
builder = _load_builder(ring).to_dict()
|
||||||
r = _load_builder(ring).to_dict()
|
replicas = builder['replicas']
|
||||||
replicas = r['replicas']
|
zones = [dev['zone'] for dev in builder['devs']]
|
||||||
zones = [d['zone'] for d in r['devs']]
|
|
||||||
if len(set(zones)) < replicas:
|
if len(set(zones)) < replicas:
|
||||||
do_rebalance = False
|
return False
|
||||||
return do_rebalance
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def do_openstack_upgrade(configs):
|
def do_openstack_upgrade(configs):
|
||||||
|
|||||||
Reference in New Issue
Block a user