3e303bea4c
* Refactor integration test for lvg module to introduce grow/reduce test * List correctly current PV in lvg module: fix lvg reduce Previous behaviour was to only take into account PV passed in 'pvs' argument. This lead to reduce not working as expecting: * with state=present and list of wanted pvs, lvg found only the pvs to add or already present and ignored the pv to remove (obviously absent from the list of given PV) * with state=absent and a pv to remove, lvg found that the remaining pvs list is empty (ignoring possible other PV in the vg) and decides to remove the vg entirely (as supposely no PV are left anymore to store lvm metadata) * Add changelog fragment
33 lines
834 B
YAML
33 lines
834 B
YAML
- name: "Create volume group on first disk"
|
|
lvg:
|
|
vg: testvg
|
|
pvs: "{{ loop_device1.stdout }}"
|
|
|
|
- name: "get lvm facts"
|
|
setup:
|
|
|
|
- debug: var=ansible_lvm
|
|
|
|
- name: "Assert the testvg span only on first disk"
|
|
assert:
|
|
that:
|
|
- ansible_lvm.pvs[loop_device1.stdout].vg == "testvg"
|
|
- 'loop_device2.stdout not in ansible_lvm.pvs or
|
|
ansible_lvm.pvs[loop_device2.stdout].vg == ""'
|
|
|
|
- name: "Extend to second disk AND reduce from the first disk"
|
|
lvg:
|
|
vg: testvg
|
|
pvs: "{{ loop_device2.stdout }}"
|
|
|
|
- name: "get lvm facts"
|
|
setup:
|
|
|
|
- debug: var=ansible_lvm
|
|
|
|
- name: "Assert the testvg span only on first disk"
|
|
assert:
|
|
that:
|
|
- 'loop_device1.stdout not in ansible_lvm.pvs or
|
|
ansible_lvm.pvs[loop_device1.stdout].vg == ""'
|
|
- ansible_lvm.pvs[loop_device2.stdout].vg == "testvg"
|