[LU-15565] lfs getstripe --yaml should use an array for components Created: 18/Feb/22 Updated: 05/Jan/23 |
|
| Status: | Open |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | John Hammond | Assignee: | WC Triage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Severity: | 3 | ||||||||||||
| Rank (Obsolete): | 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 "components {0...}" 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")' |
| Comments |
| Comment by John Hammond [ 18/Feb/22 ] |
|
adilger what do you think about changing this to be more yaml correct? |
| Comment by Andreas Dilger [ 19/Feb/22 ] |
|
I don't think there was a particular reason for the current format being used. What would the new format look like? The main concern would be compatibility with existing YAML parsers, as well as any regression tests that depend on the current format (not sure if those exist), but if you say that the current format is not very YAML-friendly, then that is probably not likely to be an issue. |
| Comment by John Hammond [ 19/Feb/22 ] |
$ lfs getstripe --yaml f0
lcm_layout_gen: 1
lcm_mirror_count: 2
lcm_entry_count: 2
components:
- 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
- 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
|
| Comment by Andreas Dilger [ 19/Feb/22 ] |
|
Looks reasonable. |