Details
-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
3
-
9223372036854775807
Description
For composite files lfs getstripe --yaml uses a key for each component rather than an array:
$ lfs getstripe --yaml f0 lcm_layout_gen: 1 lcm_mirror_count: 2 lcm_entry_count: 2 component0: lcme_id: 65537 lcme_mirror_id: 1 lcme_flags: init lcme_extent.e_start: 0 lcme_extent.e_end: EOF sub_layout: lmm_stripe_count: 1 lmm_stripe_size: 1048576 lmm_pattern: raid0 lmm_layout_gen: 0 lmm_stripe_offset: 2 lmm_objects: - l_ost_idx: 2 l_fid: 0x100020000:0xd1:0x0 component1: lcme_id: 131073 lcme_mirror_id: 2 lcme_flags: init lcme_extent.e_start: 0 lcme_extent.e_end: EOF sub_layout: lmm_stripe_count: 1 lmm_stripe_size: 1048576 lmm_pattern: raid0 lmm_layout_gen: 0 lmm_stripe_offset: 3 lmm_objects: - l_ost_idx: 3 l_fid: 0x100030000:0xd1:0x0
Using "components0..." instead of any array is poor YAML style and hinders the use of the output with common YAML tooling. If an array ("components") was used instead of numbered keys then we could do things like:
lfs getstripe --yaml f0 | yq '.components[] | select(.lcme_flags == "init,stale")'
yeah, these were just my notes on what was wrong with the format, hadn't posted them to wc.
#1 fine. just ugly.
#2, #3 were fixed with this patch.
#4 DoM components should indicate e.g. which MDT they live on, and reasonably the output could look like an OST stripe entry, per my example.
#5 Just saying that proper yaml would represent this list as an array
#6 lfs seems to output stripes in two forms, the single-line form with {} and the multi-line form. For the single-line form you need the quotes around the fid to demarcate the keys/values. (And it doesn't hurt the multi-line form).
Bigger issue: in my example version, it's trivial to visually see that there are two mirrored layouts. In the current form, with e.g. 2 pfl layouts mirrored, it looks like a list of 6 components, instead of 2 groups of 3. Everything is flat, and you have to search for lcme_mirror_id in each entry in this array to associate which components go together to form a copy of the data. Plus note that you can include per-mirror data (mirror state, component count) in my form.
Bigger issue B: Is there any reason to keep the non-yaml output format? YAML is supposed to be equally human and machine readable, seems dumb to have two different formats for that.
To be clear, I'm not demanding we fix these things, just noting for the future if anyone comes back to this ticket to fix more things, here's some things to think about.