-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* LVMVDO support - added support for LVM VDO - new accepted pool options: - vdo_compression - vdo_deduplication - vdo_size - added tests for LVM VDO - added support for COPR repositories * remove extraneous blank lines at end of file remove extraneous blank lines at end of file * use pipefail; reduce line length use pipefail; reduce line length * fix line length issues; use multiline when fix line length issues; use multiline `when` * make sure all tasks are named make sure all tasks are named * fix line length using multiline when; remove extra blank lines fix line length using multiline `when`; remove extra blank lines * wrap lines to shorten line length wrap lines to shorten line length Co-authored-by: Richard Megginson <[email protected]>
- Loading branch information
Showing
13 changed files
with
301 additions
and
6 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
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,16 @@ | ||
--- | ||
- name: make sure COPR is not already enabled | ||
shell: | | ||
set -euo pipefail | ||
{{ ansible_pkg_mgr }} repolist | \ | ||
grep -c `echo {{ repo.repository }} | tr / :` || true | ||
args: | ||
warn: false | ||
register: copr_present | ||
changed_when: false | ||
|
||
- name: get list of COPRs to be enabled | ||
command: | ||
cmd: "{{ ansible_pkg_mgr }} -y copr enable {{ repo.repository }}" | ||
warn: false | ||
when: copr_present.stdout == "0" |
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,26 @@ | ||
--- | ||
- name: check if the COPR support packages should be installed | ||
set_fact: | ||
install_copr: yes | ||
loop: "{{ _storage_copr_packages|default([]) }}" | ||
loop_control: | ||
loop_var: repo | ||
when: | ||
- _storage_copr_packages is defined | ||
- copr_packages is defined | ||
- repo.packages|intersect(copr_packages)|length | ||
|
||
- name: make sure COPR support packages are present | ||
package: | ||
name: "{{ _storage_copr_support_packages }}" | ||
when: install_copr is defined and install_copr | bool | ||
|
||
- name: enable COPRs | ||
include_tasks: "enable_copr.yml" | ||
loop: "{{ _storage_copr_packages|default([]) }}" | ||
loop_control: | ||
loop_var: repo | ||
when: | ||
- _storage_copr_packages is defined | ||
- copr_packages is defined | ||
- repo.packages|intersect(copr_packages)|length |
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
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,118 @@ | ||
--- | ||
- hosts: all | ||
become: true | ||
vars: | ||
storage_safe_mode: false | ||
mount_location: '/opt/test1' | ||
volume_group_size: '10g' | ||
volume_size: '12g' | ||
pool_size: '9g' | ||
|
||
tasks: | ||
- include_role: | ||
name: linux-system-roles.storage | ||
|
||
- name: Gather package facts | ||
package_facts: | ||
# gather information about packages | ||
|
||
- name: Set blivet package name | ||
set_fact: | ||
blivet_pkg_name: "{{ ansible_facts.packages | select('search','blivet') | select('search', 'python') | list }}" | ||
|
||
- name: Set blivet package version | ||
set_fact: | ||
blivet_pkg_version: "{{ ansible_facts.packages[blivet_pkg_name[0]][0]['version'] + '-' + ansible_facts.packages[blivet_pkg_name[0]][0]['release'] }}" | ||
|
||
- block: | ||
- include_tasks: get_unused_disk.yml | ||
vars: | ||
min_size: "{{ volume_group_size }}" | ||
max_return: 1 | ||
|
||
- name: Create LVM VDO volume under volume group 'pool1' | ||
include_role: | ||
name: linux-system-roles.storage | ||
vars: | ||
storage_pools: | ||
- name: pool1 | ||
disks: "{{ unused_disks }}" | ||
volumes: | ||
- name: volume1 | ||
compression: true | ||
deduplication: true | ||
vdo_pool_size: "{{ pool_size }}" | ||
size: "{{ volume_size }}" | ||
mount_point: "{{ mount_location }}" | ||
|
||
- include_tasks: verify-role-results.yml | ||
|
||
- name: Repeat the previous invocation to verify idempotence | ||
include_role: | ||
name: linux-system-roles.storage | ||
vars: | ||
storage_pools: | ||
- name: pool1 | ||
disks: "{{ unused_disks }}" | ||
volumes: | ||
- name: volume1 | ||
compression: true | ||
deduplication: true | ||
vdo_pool_size: "{{ pool_size }}" | ||
size: "{{ volume_size }}" | ||
mount_point: "{{ mount_location }}" | ||
|
||
- include_tasks: verify-role-results.yml | ||
|
||
- name: Remove LVM VDO volume in 'pool1' created above | ||
include_role: | ||
name: linux-system-roles.storage | ||
vars: | ||
storage_pools: | ||
- name: pool1 | ||
disks: "{{ unused_disks }}" | ||
state: "absent" | ||
volumes: | ||
- name: volume1 | ||
compression: true | ||
deduplication: true | ||
vdo_pool_size: "{{ pool_size }}" | ||
size: "{{ volume_size }}" | ||
mount_point: "{{ mount_location }}" | ||
|
||
- include_tasks: verify-role-results.yml | ||
|
||
- name: Create LVM VDO volume under volume group 'pool1' (this time default size) | ||
include_role: | ||
name: linux-system-roles.storage | ||
vars: | ||
storage_pools: | ||
- name: pool1 | ||
disks: "{{ unused_disks }}" | ||
volumes: | ||
- name: volume1 | ||
compression: true | ||
deduplication: true | ||
size: "{{ volume_size }}" | ||
mount_point: "{{ mount_location }}" | ||
|
||
- include_tasks: verify-role-results.yml | ||
|
||
- name: Remove LVM VDO volume in 'pool1' created above | ||
include_role: | ||
name: linux-system-roles.storage | ||
vars: | ||
storage_pools: | ||
- name: pool1 | ||
disks: "{{ unused_disks }}" | ||
state: "absent" | ||
volumes: | ||
- name: volume1 | ||
compression: true | ||
deduplication: true | ||
size: "{{ volume_size }}" | ||
mount_point: "{{ mount_location }}" | ||
|
||
- include_tasks: verify-role-results.yml | ||
|
||
when: blivet_pkg_version is version("3.2.2-10", ">=") and ansible_facts["distribution"] != "Fedora" |
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,40 @@ | ||
- name: check VDO | ||
block: | ||
- name: get information about VDO deduplication | ||
command: "vdostats --verbose {{ storage_test_pool.name }}-vdopool-vpool" | ||
register: storage_test_vdo_status | ||
changed_when: false | ||
|
||
- set_fact: | ||
storage_test_vdo_dedupe_re: "{{ ('maximum dedupe queries +: +0$') }}" | ||
|
||
- assert: | ||
that: "storage_test_vdo_status.stdout is regex(storage_test_vdo_dedupe_re)" | ||
msg: "VDO deduplication is on but it should not" | ||
when: not storage_test_vdo_volume.deduplication | ||
|
||
- assert: | ||
that: "storage_test_vdo_status.stdout is not regex(storage_test_vdo_dedupe_re)" | ||
msg: "VDO deduplication is off but it should not" | ||
when: storage_test_vdo_volume.deduplication | bool | ||
|
||
- set_fact: | ||
storage_test_vdo_compress_re: "{{ ('compressed fragments written +: +0$') }}" | ||
|
||
- assert: | ||
that: "storage_test_vdo_status.stdout is regex(storage_test_vdo_compress_re)" | ||
msg: "VDO compression is on but it should not" | ||
when: not storage_test_vdo_volume.compression | ||
|
||
- assert: | ||
that: "storage_test_vdo_status.stdout is not regex(storage_test_vdo_compress_re)" | ||
msg: "VDO compression is off but it should not" | ||
when: storage_test_vdo_volume.compression | bool | ||
|
||
when: | ||
- storage_test_vdo_volume.deduplication != none or storage_test_vdo_volume.compression != none | ||
- storage_test_pool.state != "absent" | ||
- storage_test_vdo_volume.state != "absent" | ||
|
||
- set_fact: | ||
storage_test_vdo_status: null |
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,6 @@ | ||
- name: Validate pool member VDO settings | ||
include_tasks: verify-pool-member-vdo.yml | ||
loop: "{{ storage_test_pool.volumes }}" | ||
loop_control: | ||
loop_var: storage_test_vdo_volume | ||
when: storage_test_pool.type == 'lvm' |
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 |
---|---|---|
|
@@ -5,3 +5,5 @@ blivet_package_list: | |
- libblockdev-lvm | ||
- libblockdev-mdraid | ||
- libblockdev-swap | ||
- vdo | ||
- kmod-kvdo |
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 |
---|---|---|
|
@@ -5,3 +5,5 @@ blivet_package_list: | |
- libblockdev-lvm | ||
- libblockdev-mdraid | ||
- libblockdev-swap | ||
- vdo | ||
- kmod-kvdo |