From f39fea0f8985a4937282aa075d80009a45cdf81d Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Mon, 23 Jun 2025 17:35:28 -0400 Subject: [PATCH] Calculate PE size, and subtract from the shrink size; Attempts to fix allocation/pretending size issue --- tasks/capture_lv_device_details.yml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tasks/capture_lv_device_details.yml b/tasks/capture_lv_device_details.yml index a0d413b..c220899 100644 --- a/tasks/capture_lv_device_details.yml +++ b/tasks/capture_lv_device_details.yml @@ -73,9 +73,6 @@ ansible.builtin.debug: msg: "{{ bigboot_lv_shrink_size | int | human_readable(unit='G') }} ({{ bigboot_lv_shrink_size | int | human_readable(unit='M') | regex_replace('\\.\\d+\\s+MB') | int | get_block_size_down }}) <-> {{ bigboot_size_target_fallback }} | {{ bigboot_expansion_diff }}" -# - name: Kill the play -# ansible.builtin.meta: end_host - - name: Capture logical volume name ansible.builtin.shell: cmd: | @@ -98,6 +95,26 @@ changed_when: false register: bigboot_lv_vg_free_pe +- name: Capture volume group PE size + ansible.builtin.shell: + cmd: | + set -o pipefail + vgdisplay {{ bigboot_lv_vg_name | trim }} | grep -i 'pe size' + executable: /bin/bash + changed_when: false + register: bigboot_lv_vg_pe_capture + +- name: Set PE size + ansible.builtin.set_fact: + bigboot_lv_vg_pe_size: "{{ bigboot_lv_vg_pe_capture | regex_replace('^.*\\s+(\\d+.\\d+).*$', '\\1M') | human_to_bytes }}" + +- name: Subtract one additional PE for shrinking + ansible.builtin.set_fact: + bigboot_lv_shrink_size: "{{ bigboot_lv_shrink_size | int - bigboot_lv_vg_pe_size | int }}" + +# - name: Kill the play +# ansible.builtin.meta: end_host + - name: Capture the PV device ansible.builtin.set_fact: bigboot_pv: "{{ bigboot_boot_mount['device'][:-1] }}{{ bigboot_boot_mount['device'][-1:] | int + 1 }}"