lvol: Fix pct of origin (#7053)

* add support for percentage of origin size for creating snapshot volumes

* add changelog fragment

* add pull request link

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix what's not idempotent

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Bob Mader 2023-08-12 02:58:12 -05:00 committed by GitHub
parent 5988b9acea
commit a0c67a8894
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 16 deletions

View file

@ -4,7 +4,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- name: "Create files to use as a disk devices"
command: "dd if=/dev/zero of={{ remote_tmp_dir }}/img{{ item }} bs=1M count=10"
command: "dd if=/dev/zero of={{ remote_tmp_dir }}/img{{ item }} bs=1M count=36"
with_sequence: 'count=4'
- name: "Show next free loop device"

View file

@ -17,6 +17,16 @@
lv: "{{ item }}"
size: 2m
- name: Create snapshot volumes of origin logical volumes
loop:
- lv1
- lv2
lvol:
vg: testvg
lv: "{{ item }}"
snapshot: "{{ item }}_snap"
size: 50%ORIGIN
- name: Collect all lv active status in testvg
shell: vgs -olv_active --noheadings testvg | xargs -n1
register: initial_lv_status_result

View file

@ -12,10 +12,10 @@
shell: vgs -v testvg -o pv_size --noheading --units b | xargs
register: cmd_result
- name: Assert the testvg size is 8388608B
- name: Assert the testvg size is 33554432B
assert:
that:
- "'8388608B' == cmd_result.stdout"
- "'33554432B' == 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"
@ -38,10 +38,10 @@
shell: vgs -v testvg -o pv_size --noheading --units b | xargs
register: cmd_result
- name: Assert the testvg size is still 8388608B
- name: Assert the testvg size is still 33554432B
assert:
that:
- "'8388608B' == cmd_result.stdout"
- "'33554432B' == cmd_result.stdout"
- name: "Reruns lvg with pvresize:yes and check_mode:yes"
lvg:
@ -60,10 +60,10 @@
shell: vgs -v testvg -o pv_size --noheading --units b | xargs
register: cmd_result
- name: Assert the testvg size is still 8388608B
- name: Assert the testvg size is still 33554432B
assert:
that:
- "'8388608B' == cmd_result.stdout"
- "'33554432B' == cmd_result.stdout"
- name: "Reruns lvg with pvresize:yes"
lvg:
@ -75,7 +75,7 @@
shell: vgs -v testvg -o pv_size --noheading --units b | xargs
register: cmd_result
- name: Assert the testvg size is now 16777216B
- name: Assert the testvg size is now 41943040B
assert:
that:
- "'16777216B' == cmd_result.stdout"
- "'41943040B' == cmd_result.stdout"