Revert "Ensure storage hooks observe disable-ring-rebalance"
This reverts commit 1cf5ea71d0
which
is not required as the should_balance function already inspects
the configuration option that enforces ring balancing via actions.
Change-Id: I79c1be12f680c446d556dc16e9dfbd60a7d9db38
This commit is contained in:
parent
426f03c576
commit
655d5be16a
|
@ -171,8 +171,7 @@ def config_changed():
|
||||||
status_set('maintenance', 'Running openstack upgrade')
|
status_set('maintenance', 'Running openstack upgrade')
|
||||||
|
|
||||||
status_set('maintenance', 'Updating and (maybe) balancing rings')
|
status_set('maintenance', 'Updating and (maybe) balancing rings')
|
||||||
update_rings(min_part_hours=config('min-hours'),
|
update_rings(min_part_hours=config('min-hours'))
|
||||||
rebalance=not config('disable-ring-balance'))
|
|
||||||
|
|
||||||
if not config('disable-ring-balance') and is_elected_leader(SWIFT_HA_RES):
|
if not config('disable-ring-balance') and is_elected_leader(SWIFT_HA_RES):
|
||||||
# Try ring balance. If rings are balanced, no sync will occur.
|
# Try ring balance. If rings are balanced, no sync will occur.
|
||||||
|
@ -332,11 +331,7 @@ def storage_changed():
|
||||||
node['device'] = dev
|
node['device'] = dev
|
||||||
nodes.append(node)
|
nodes.append(node)
|
||||||
|
|
||||||
# NOTE(jamespage): ensure that disable-ring-balance is observed
|
update_rings(nodes)
|
||||||
# whilst new storage is added - rebalance will
|
|
||||||
# happen when configuration is toggled later
|
|
||||||
update_rings(nodes, rebalance=not config('disable-ring-balance'))
|
|
||||||
|
|
||||||
if not openstack.is_unit_paused_set():
|
if not openstack.is_unit_paused_set():
|
||||||
# Restart proxy here in case no config changes made (so
|
# Restart proxy here in case no config changes made (so
|
||||||
# restart_on_change() ineffective).
|
# restart_on_change() ineffective).
|
||||||
|
|
|
@ -865,7 +865,7 @@ def sync_builders_and_rings_if_changed(f):
|
||||||
|
|
||||||
|
|
||||||
@sync_builders_and_rings_if_changed
|
@sync_builders_and_rings_if_changed
|
||||||
def update_rings(nodes=[], min_part_hours=None, rebalance=True):
|
def update_rings(nodes=[], min_part_hours=None):
|
||||||
"""Update builder with node settings and balance rings if necessary.
|
"""Update builder with node settings and balance rings if necessary.
|
||||||
|
|
||||||
Also update min_part_hours if provided.
|
Also update min_part_hours if provided.
|
||||||
|
@ -903,7 +903,7 @@ def update_rings(nodes=[], min_part_hours=None, rebalance=True):
|
||||||
add_to_ring(ring, node)
|
add_to_ring(ring, node)
|
||||||
balance_required = True
|
balance_required = True
|
||||||
|
|
||||||
if rebalance and balance_required:
|
if balance_required:
|
||||||
balance_rings()
|
balance_rings()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -90,13 +90,6 @@ class SwiftUtilsTestCase(unittest.TestCase):
|
||||||
self.assertTrue(mock_set_min_hours.called)
|
self.assertTrue(mock_set_min_hours.called)
|
||||||
self.assertTrue(mock_balance_rings.called)
|
self.assertTrue(mock_balance_rings.called)
|
||||||
|
|
||||||
mock_balance_rings.reset_mock()
|
|
||||||
swift_utils.update_rings(min_part_hours=10,
|
|
||||||
rebalance=False)
|
|
||||||
self.assertTrue(mock_get_min_hours.called)
|
|
||||||
self.assertTrue(mock_set_min_hours.called)
|
|
||||||
self.assertFalse(mock_balance_rings.called)
|
|
||||||
|
|
||||||
@mock.patch('lib.swift_utils.previously_synced')
|
@mock.patch('lib.swift_utils.previously_synced')
|
||||||
@mock.patch('lib.swift_utils._load_builder')
|
@mock.patch('lib.swift_utils._load_builder')
|
||||||
@mock.patch('lib.swift_utils.initialize_ring')
|
@mock.patch('lib.swift_utils.initialize_ring')
|
||||||
|
|
Loading…
Reference in New Issue