generated from linux-system-roles/template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for LVM thin volumes
Update to ignore thinpool LVs and support think provisioned sources. Signed-off-by: Todd Gill <[email protected]>
- Loading branch information
Showing
3 changed files
with
336 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
--- | ||
- name: Snapshot a set of logical volumes across different volume groups | ||
hosts: all | ||
vars: | ||
test_disk_min_size: "1g" | ||
test_disk_count: 10 | ||
test_storage_pools: | ||
- name: test_vg1 | ||
disks: "{{ range(0, 6) | map('extract', unused_disks) | list }}" | ||
volumes: | ||
- name: thin_pool_dev | ||
thin_pool_name: thin_pool | ||
thin_pool_size: '3g' | ||
size: "1g" | ||
thin: true | ||
- name: lv2 | ||
thin_pool_name: thin_pool | ||
size: "15" | ||
thin: true | ||
- name: lv3 | ||
thin_pool_name: thin_pool | ||
size: "15%" | ||
thin: true | ||
- name: lv4 | ||
thin_pool_name: thin_pool | ||
size: "15%" | ||
thin: true | ||
- name: test_vg2 | ||
disks: "{{ range(6, 10) | map('extract', unused_disks) | list }}" | ||
volumes: | ||
- name: lv5 | ||
size: "30%" | ||
- name: lv6 | ||
size: "25%" | ||
- name: lv7 | ||
size: "10%" | ||
- name: lv8 | ||
size: "10%" | ||
snapshot_test_set: | ||
name: snapset1 | ||
volumes: | ||
- name: snapshot VG1 LV2 | ||
vg: test_vg1 | ||
lv: lv2 | ||
percent_space_required: 20 | ||
- name: snapshot VG1 LV3 | ||
vg: test_vg1 | ||
lv: lv3 | ||
percent_space_required: 20 | ||
- name: snapshot VG2 LV5 | ||
vg: test_vg2 | ||
lv: lv5 | ||
percent_space_required: 15 | ||
- name: snapshot VG2 LV8 | ||
vg: test_vg2 | ||
lv: lv8 | ||
percent_space_required: 15 | ||
thin_pool: thin_pool | ||
|
||
tasks: | ||
- name: Run tests | ||
block: | ||
- name: Setup | ||
include_tasks: tasks/setup.yml | ||
|
||
- name: Run the snapshot role to create snapshot set of LVs | ||
include_role: | ||
name: linux-system-roles.snapshot | ||
vars: | ||
snapshot_lvm_action: snapshot | ||
snapshot_lvm_set: "{{ snapshot_test_set }}" | ||
|
||
- name: Assert changes for create snapset | ||
assert: | ||
that: snapshot_cmd["changed"] | ||
|
||
- name: Run the snapshot role to verify the set of snapshots for the LVs | ||
include_role: | ||
name: linux-system-roles.snapshot | ||
vars: | ||
snapshot_lvm_action: check | ||
snapshot_lvm_set: "{{ snapshot_test_set }}" | ||
snapshot_lvm_verify_only: true | ||
|
||
- name: Create snapset again for idempotence | ||
include_role: | ||
name: linux-system-roles.snapshot | ||
vars: | ||
snapshot_lvm_action: snapshot | ||
snapshot_lvm_set: "{{ snapshot_test_set }}" | ||
|
||
- name: Assert no changes for create snapset | ||
assert: | ||
that: not snapshot_cmd["changed"] | ||
|
||
- name: Run the snapshot role remove the set | ||
include_role: | ||
name: linux-system-roles.snapshot | ||
vars: | ||
snapshot_lvm_action: remove | ||
snapshot_lvm_set: "{{ snapshot_test_set }}" | ||
|
||
- name: Assert changes for remove snapset | ||
assert: | ||
that: snapshot_cmd["changed"] | ||
|
||
- name: Run the snapshot role to verify the set is removed | ||
include_role: | ||
name: linux-system-roles.snapshot | ||
vars: | ||
snapshot_lvm_action: remove | ||
snapshot_lvm_set: "{{ snapshot_test_set }}" | ||
snapshot_lvm_verify_only: true | ||
|
||
- name: Remove again to check idempotence | ||
include_role: | ||
name: linux-system-roles.snapshot | ||
vars: | ||
snapshot_lvm_action: remove | ||
snapshot_lvm_set: "{{ snapshot_test_set }}" | ||
|
||
- name: Assert no changes for remove snapset | ||
assert: | ||
that: not snapshot_cmd["changed"] | ||
always: | ||
- name: Cleanup | ||
include_tasks: tasks/cleanup.yml | ||
tags: tests::cleanup |
Oops, something went wrong.