mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-08 22:30:04 -07:00
LVG: add new parameter pvresize (#422)
* enabling resize in pv. * change pvresize default behavior to false * includes changelog on pvresize * punctuation fix Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> * fixes typo and changes pvresize_cmd location * Update changelogs/fragments/442-add-new-parameter-pvresize.yaml Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> * Update plugins/modules/system/lvg.py Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> * rebase and add EXAMPLE for pvresize * fix wrongly submited merge conflict * Update plugins/modules/system/lvg.py Co-authored-by: Felix Fontein <felix@fontein.de> * adding tests * add test for check_mode * fix identation * Update tests/integration/targets/lvg/tasks/test_pvresize.yml Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> * Update tests/integration/targets/lvg/tasks/test_pvresize.yml Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> * fix identation Co-authored-by: CASSIO ALVES <cassioalves@bocombbm.com.br> Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: cassio alves <cassio@localhost.localdomain>
This commit is contained in:
parent
317532f8bd
commit
9de5c0c53c
4 changed files with 118 additions and 0 deletions
76
tests/integration/targets/lvg/tasks/test_pvresize.yml
Normal file
76
tests/integration/targets/lvg/tasks/test_pvresize.yml
Normal file
|
@ -0,0 +1,76 @@
|
|||
- name: "Create volume group on first disk"
|
||||
lvg:
|
||||
vg: testvg
|
||||
pvs: "{{ loop_device1.stdout }}"
|
||||
|
||||
- name: Gets current vg size
|
||||
shell: vgs -v testvg -o pv_size --noheading --units b | xargs
|
||||
register: cmd_result
|
||||
|
||||
- name: Assert the testvg size is 8388608B
|
||||
assert:
|
||||
that:
|
||||
- "'8388608B' == cmd_result.stdout"
|
||||
|
||||
- name: Increases size in file
|
||||
command: "dd if=/dev/zero bs=8MiB count=1 of={{ remote_tmp_dir }}/img1 conv=notrunc oflag=append"
|
||||
|
||||
- name: "Reread size of file associated with loop_device1"
|
||||
command: "losetup -c {{ loop_device1.stdout }}"
|
||||
|
||||
- name: "Reruns lvg with pvresize:no"
|
||||
lvg:
|
||||
vg: testvg
|
||||
pvs: "{{ loop_device1.stdout }}"
|
||||
pvresize: no
|
||||
register: cmd_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- cmd_result is not changed
|
||||
|
||||
- name: Gets current vg size
|
||||
shell: vgs -v testvg -o pv_size --noheading --units b | xargs
|
||||
register: cmd_result
|
||||
|
||||
- name: Assert the testvg size is still 8388608B
|
||||
assert:
|
||||
that:
|
||||
- "'8388608B' == cmd_result.stdout"
|
||||
|
||||
- name: "Reruns lvg with pvresize:yes and check_mode:yes"
|
||||
lvg:
|
||||
vg: testvg
|
||||
pvs: "{{ loop_device1.stdout }}"
|
||||
pvresize: yes
|
||||
check_mode: yes
|
||||
register: cmd_result
|
||||
|
||||
- name: Assert that the module returned the state was changed
|
||||
assert:
|
||||
that:
|
||||
- cmd_result is changed
|
||||
|
||||
- name: Gets current vg size
|
||||
shell: vgs -v testvg -o pv_size --noheading --units b | xargs
|
||||
register: cmd_result
|
||||
|
||||
- name: Assert the testvg size is still 8388608B
|
||||
assert:
|
||||
that:
|
||||
- "'8388608B' == cmd_result.stdout"
|
||||
|
||||
- name: "Reruns lvg with pvresize:yes"
|
||||
lvg:
|
||||
vg: testvg
|
||||
pvs: "{{ loop_device1.stdout }}"
|
||||
pvresize: yes
|
||||
|
||||
- name: Gets current vg size
|
||||
shell: vgs -v testvg -o pv_size --noheading --units b | xargs
|
||||
register: cmd_result
|
||||
|
||||
- name: Assert the testvg size is now 16777216B
|
||||
assert:
|
||||
that:
|
||||
- "'16777216B' == cmd_result.stdout"
|
Loading…
Add table
Add a link
Reference in a new issue