-
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.
Merge pull request #105 from japokorn/master-mdraid_support_volumes
MDRAID support for volumes
- Loading branch information
Showing
12 changed files
with
421 additions
and
13 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 |
---|---|---|
|
@@ -3,3 +3,4 @@ standard-inventory-qcow2: | |
drive: | ||
- size: 10737418240 | ||
- size: 10737418240 | ||
- size: 10737418240 |
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 |
---|---|---|
@@ -1,12 +1,33 @@ | ||
--- | ||
|
||
# | ||
# MDRaid devices paths are returned as a symlinks. But sometimes we need their targets. | ||
# | ||
- name: (1/3) Process device path (set initial value) | ||
set_fact: | ||
storage_test_device_path: "{{ storage_test_volume._device }}" | ||
|
||
# realpath fails when given empty string; the task then returns completely different dict. | ||
- block: | ||
- name: (2/3) Process device path (get device file info) | ||
command: realpath "{{ storage_test_volume._device }}" | ||
register: storage_test_realpath | ||
|
||
- name: (3/3) Process device path (replace device with its target if it is a symlink) | ||
set_fact: | ||
storage_test_device_path: "{{ storage_test_realpath.stdout }}" | ||
when: storage_test_device_path not in storage_test_blkinfo.info | ||
|
||
when: storage_test_volume._device != "" | ||
|
||
# type | ||
- name: Verify fs type | ||
assert: | ||
that: "{{ storage_test_blkinfo.info[storage_test_volume._device].fstype == storage_test_volume.fs_type }}" | ||
that: "{{ storage_test_blkinfo.info[storage_test_device_path].fstype == storage_test_volume.fs_type }}" | ||
when: storage_test_volume.fs_type and _storage_test_volume_present | ||
|
||
# label | ||
- name: Verify fs label | ||
assert: | ||
that: "{{ storage_test_blkinfo.info[storage_test_volume._device].label == storage_test_volume.fs_label }}" | ||
that: "{{ storage_test_blkinfo.info[storage_test_device_path].label == storage_test_volume.fs_label }}" | ||
when: _storage_test_volume_present |
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,43 @@ | ||
--- | ||
|
||
# Only when volume is raid | ||
- name: check RAID options | ||
block: | ||
|
||
- name: get information about RAID | ||
command: "mdadm --detail {{ storage_test_volume._raw_device }}" | ||
register: storage_test_mdadm | ||
changed_when: false | ||
|
||
# pre-chew regex search patterns | ||
- set_fact: | ||
storage_test_md_active_devices_re: "{{('Active Devices : ' ~ storage_test_volume.raid_device_count ~ '\n')|regex_escape()}}" | ||
when: storage_test_volume.raid_device_count is defined | ||
|
||
- set_fact: | ||
storage_test_md_spare_devices_re: "{{('Spare Devices : ' ~ storage_test_volume.raid_spare_count ~ '\n')|regex_escape()}}" | ||
when: storage_test_volume.raid_spare_count is defined | ||
|
||
- set_fact: | ||
storage_test_md_metadata_version_re: "{{('Version : ' ~ storage_test_volume.raid_metadata_version ~ '\n')|regex_escape()}}" | ||
when: storage_test_volume.raid_metadata_version is defined | ||
|
||
- name: check RAID active devices count | ||
assert: | ||
that: "storage_test_mdadm.stdout is regex(storage_test_md_active_devices_re)" | ||
msg: "Expected {{ storage_test_volume.raid_device_count }} active RAID devices." | ||
when: storage_test_volume.raid_device_count is not none | ||
|
||
- name: check RAID spare devices count | ||
assert: | ||
that: "storage_test_mdadm.stdout is regex(storage_test_md_spare_devices_re)" | ||
msg: "Expected {{ storage_test_volume.raid_spare_count }} spare RAID devices." | ||
when: storage_test_volume.raid_spare_count is not none | ||
|
||
- name: check RAID metadata version | ||
assert: | ||
that: "storage_test_mdadm.stdout is regex(storage_test_md_metadata_version_re)" | ||
msg: "Expected {{ storage_test_volume.raid_metadata_version }} RAID metadata version." | ||
when: storage_test_volume.raid_metadata_version is not none | ||
|
||
when: storage_test_volume.type == 'raid' and storage_test_volume._device != "" |
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
Oops, something went wrong.