Guardrails to ensure we dont run target LV out of space; minor tweaks

This commit is contained in:
Chris Hammer 2025-06-02 12:28:17 -04:00
parent 37d44db328
commit d0caf12112
3 changed files with 14 additions and 2 deletions

View File

@ -109,7 +109,7 @@
- name: Assert if we need to shrink the logical volume to gain PE
ansible.builtin.assert:
that: (bigboot_lv_pe_size_in_mb[:-3] | int) >= (bigboot_expansion_diff_mb[:-3] | int)
fail_msg: Not enough PE to expand /boot.
fail_msg: Not enough PE to expand /boot. Will need to shrink target LV.
rescue:
- name: Set flag for Shrink_LV execution

View File

@ -7,7 +7,7 @@
ansible.builtin.assert:
that: bigboot_size_target_fallback | int >= bigboot_size_min | human_to_bytes
fail_msg:
"{{ bigboot_size_target_fallback | int | human_readable(unit='M') }} is less than the minimum of {{ bigboot_size_min }}"
"{{ bigboot_size_target_fallback | int | human_readable(unit='M') }} is less than the minimum required size of {{ bigboot_size_min }}."
- name: Verify available space and re-check if needed
block:
@ -16,6 +16,16 @@
that: bigboot_lv_info['size_available'] > bigboot_expansion_diff | int
fail_msg: There is not enough free space available to shrink the filesystem
- name: Debug bigboot_lv_info
ansible.builtin.debug:
msg: "{{ bigboot_lv_info['size_available'] }} -> {{ bigboot_expansion_diff }} -> {{ bigboot_lv_size_min | human_to_bytes }}"
- name: Assert that there will be enough space left over on the target LV
ansible.builtin.assert:
that: (bigboot_lv_info['size_available'] - bigboot_expansion_diff | int) >= bigboot_lv_size_min | human_to_bytes
success_msg: "There will be enough space left over with a boot size of {{ bigboot_size_target_fallback | int | human_readable(unit='G') }}."
fail_msg: "There will NOT be enough space left over with a boot size of {{ bigboot_size_target_fallback | int | human_readable(unit='G') }}. Aborting Bigboot execution."
rescue:
- name: "Decrement size target by {{ bigboot_size_decrement }}"
ansible.builtin.set_fact:

View File

@ -5,6 +5,8 @@ bigboot_size_target: 2G
bigboot_size_min: 1G
bigboot_size_decrement: 250M
bigboot_lv_size_min: 1G
# Filename of disabled services log:
bigboot_disabled_services_log: /var/IPE/IPU/el7to8/bigboot_disabled_services.log