action #91758
closedcoordination #71242: [epic] Unify validation in the installed system
Validate raid partitioning layout using test data instead of regex
0%
Description
In tests/console/validate_raid.pm we use utilities lsblk and mdadm to validate our raid scenarios via regex.
lblsk has options to export to json which we can parse applying use Mojo::JSON 'decode_json'
and compare easily against test data for each scenario.
mdamd can be parsed with some smart regex having pairs of values afir, but requires some investigation, there are some options available:
mdadm --examine -E
mdadm --detail
mdadm --examine --brief
With --export output is easy to extract and looks like:
MD_LEVEL=raid5
MD_DEVICES=4
MD_METADATA=1.2
With --examine also with regext we can get those pairs:
/dev/sda:
Magic : Intel Raid ISM Cfg Sig.
Version : 1.0.00
In the same way we introduce some mapping (some hash in Perl) for the input data, we might need something similar here in some cases (i.e.: msdos->MSDOS) depending of the output of the command.
We have available every single output for each architecture, check for example here but we might need to run those command with different parameters, so it is better to check most of the output first as there are variations.
Another suggestion is to not try to examine more than one drive with a command so it simplifies the logic.
Ideas:¶
- Consider https://metacpan.org/pod/Config::IniFiles to check the output in favor of not using regex;
- Implementation of 'mdadm' should be done in scope of this ticket. For 'lsblk' part please see https://progress.opensuse.org/issues/91755.
Updated by oorlov over 3 years ago
- Related to action #91755: Split functionality for validating partitioning in partitions_validator_utils into more reusable functions added
Updated by oorlov over 3 years ago
- Description updated (diff)
- Status changed from New to Workable
Updated by riafarov over 3 years ago
- Status changed from Workable to In Progress
- Assignee set to riafarov
Updated by riafarov over 3 years ago
https://metacpan.org/pod/Config::Tiny is available and we can use it.
Updated by riafarov over 3 years ago
- Status changed from In Progress to Feedback