Check if changes have made before attempting a rebalance
Utilize the "ringbuilder.devs_changed" option to ensure that the ring needs a rebalance. This will prevent unnecessary rebalances that cause failures due to "min_part_hours" not being passed even though no changes were required. Additionally, we can now return a correct Ansible repsonse when the ring has changed/rebalanced - and return "OK" when it hasn't returned at all. Change-Id: I1fb4b3544a50ab5f566b3846d616107a84ff29c9
This commit is contained in:
parent
0dad1e4fbd
commit
57de3c8817
@ -48,9 +48,11 @@
|
||||
with_nested:
|
||||
- [ 'account', 'container' ]
|
||||
- "{{ swift_managed_regions | default([None]) }}"
|
||||
register: swift_rings_create
|
||||
become: yes
|
||||
become_user: "{{ swift_system_user_name }}"
|
||||
changed_when: false
|
||||
changed_when: "{{ swift_rings_create.rc not in [1, 2, 3] }}"
|
||||
failed_when: "{{ swift_rings_create.rc in [1, 2] }}"
|
||||
args:
|
||||
chdir: /etc/swift/ring_build_files/
|
||||
|
||||
@ -59,8 +61,10 @@
|
||||
with_nested:
|
||||
- "{{ swift.storage_policies }}"
|
||||
- "{{ swift_managed_regions | default([None]) }}"
|
||||
register: swift_object_rings_create
|
||||
become: yes
|
||||
become_user: "{{ swift_system_user_name }}"
|
||||
changed_when: false
|
||||
changed_when: "{{ swift_object_rings_create.rc not in [1, 2, 3] }}"
|
||||
failed_when: "{{ swift_object_rings_create.rc in [1, 2] }}"
|
||||
args:
|
||||
chdir: /etc/swift/ring_build_files/
|
||||
|
@ -140,11 +140,12 @@ def build_ring(build_name, repl, min_part_hours, part_power, hosts,
|
||||
|
||||
# Rebalance ring
|
||||
if not validate:
|
||||
if not hosts:
|
||||
if not hosts or not ringbuilder.devs_changed:
|
||||
ringdata = ringbuilder.get_ring()
|
||||
ringdata.save(join(backup_folder, '%d.' % ts +
|
||||
basename(ring_file)))
|
||||
ringdata.save(ring_file)
|
||||
exit(3)
|
||||
else:
|
||||
if reset_mph_clock:
|
||||
ringbuilder.pretend_min_part_hours_passed()
|
||||
|
@ -21,6 +21,8 @@ bridges:
|
||||
- name: "br-repl"
|
||||
ip_addr: "10.1.3.1"
|
||||
|
||||
swift_pretend_min_part_hours_passed: False
|
||||
|
||||
swift:
|
||||
storage_network: "{{ test_swift_storage_network | default('eth2') }}"
|
||||
replication_network: "{{ test_swift_repl_network | default('eth3') }}"
|
||||
|
Loading…
Reference in New Issue
Block a user