-
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.
feat: Added support for creating shared LVM setups
- feature requested by GFS2 - adds support for creating shared VGs - shared LVM setup needs lvmlockd service with dlm lock manager to be running - to test this change ha_cluster system role is used to set up degenerated cluster on localhost - the test will be skipped if run locally due to an issue with underlying services - requires blivet version with shared LVM setup support (storaged-project/blivet#1123)
- Loading branch information
Showing
6 changed files
with
153 additions
and
1 deletion.
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,3 @@ | ||
--- | ||
collections: | ||
- fedora.linux_system_roles |
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,121 @@ | ||
--- | ||
- name: Test LVM shared pools | ||
hosts: all | ||
become: true | ||
vars: | ||
storage_safe_mode: false | ||
storage_use_partitions: true | ||
mount_location1: '/opt/test1' | ||
volume1_size: '4g' | ||
|
||
tasks: | ||
# Skip this test if run on localhost. | ||
# Local run will not set up lvmlockd | ||
# correctly and the test would fail. | ||
- name: Create cluster and test LVM shared pools | ||
block: | ||
- name: Create cluster | ||
ansible.builtin.include_role: | ||
name: fedora.linux_system_roles.ha_cluster | ||
vars: | ||
ha_cluster_cluster_name: rhel9-1node | ||
# Users should vault-encrypt the password | ||
ha_cluster_hacluster_password: hapasswd | ||
ha_cluster_extra_packages: | ||
- dlm | ||
- lvm2-lockd | ||
ha_cluster_cluster_properties: | ||
- attrs: | ||
# Don't do this in production | ||
- name: stonith-enabled | ||
value: 'false' | ||
ha_cluster_resource_primitives: | ||
- id: dlm | ||
agent: 'ocf:pacemaker:controld' | ||
instance_attrs: | ||
- attrs: | ||
# Don't do this in production | ||
- name: allow_stonith_disabled | ||
value: 'true' | ||
- id: lvmlockd | ||
agent: 'ocf:heartbeat:lvmlockd' | ||
ha_cluster_resource_groups: | ||
- id: locking | ||
resource_ids: | ||
- dlm | ||
- lvmlockd | ||
|
||
- name: Run the role | ||
include_role: | ||
name: linux-system-roles.storage | ||
|
||
- name: Get unused disks | ||
include_tasks: get_unused_disk.yml | ||
vars: | ||
max_return: 1 | ||
|
||
- name: >- | ||
Create a disk device; specify disks as non-list mounted on | ||
{{ mount_location }} | ||
include_role: | ||
name: linux-system-roles.storage | ||
vars: | ||
storage_pools: | ||
- name: vg1 | ||
disks: "{{ unused_disks }}" | ||
type: lvm | ||
shared: true | ||
state: present | ||
volumes: | ||
- name: lv1 | ||
size: "{{ volume1_size }}" | ||
mount_point: "{{ mount_location1 }}" | ||
- name: Verify role results | ||
include_tasks: verify-role-results.yml | ||
|
||
- name: Repeat the previous step to verify idempotence | ||
include_role: | ||
name: linux-system-roles.storage | ||
vars: | ||
storage_pools: | ||
- name: vg1 | ||
disks: "{{ unused_disks }}" | ||
type: lvm | ||
shared: true | ||
state: present | ||
volumes: | ||
- name: lv1 | ||
size: "{{ volume1_size }}" | ||
mount_point: "{{ mount_location1 }}" | ||
|
||
- name: Verify role results | ||
include_tasks: verify-role-results.yml | ||
|
||
- name: >- | ||
Remove the device created above | ||
{{ mount_location }} | ||
include_role: | ||
name: linux-system-roles.storage | ||
vars: | ||
storage_pools: | ||
- name: vg1 | ||
disks: "{{ unused_disks }}" | ||
type: lvm | ||
shared: true | ||
state: absent | ||
volumes: | ||
- name: lv1 | ||
size: "{{ volume1_size }}" | ||
mount_point: "{{ mount_location1 }}" | ||
- name: Verify role results | ||
include_tasks: verify-role-results.yml | ||
|
||
- name: Remove cluster | ||
ansible.builtin.include_role: | ||
name: fedora.linux_system_roles.ha_cluster | ||
vars: | ||
ha_cluster_cluster_name: rhel9-1node | ||
ha_cluster_cluster_present: false | ||
when: inventory_hostname != 'localhost' |