zpool: fix spare/cache indentation in list -v output - #18818
Conversation
Normal vdevs come out right because of recursion into
`collect_list_stats` with a greater depth, but spare/cache details are
emitted at the top-level and need a bit more of a nudge in indentation
to avoid blending in with another zpool.
Some details omitted for brevity. Before:
$ zpool list -v -o name,size,alloc,free,health
NAME SIZE ALLOC FREE HEALTH
storage 43.7T 2.66M 43.7T ONLINE
raidz2-0 21.8T 1.30M 21.8T ONLINE
[...]
raidz2-1 21.8T 1.36M 21.8T ONLINE
[...]
spare - - - -
gpt/disk6 3.64T - - AVAIL
gpt/disk7 3.64T - - AVAIL
gpt/disk14 3.64T - - AVAIL
zroot 216G 1.40G 215G ONLINE
mirror-0 216G 1.40G 215G ONLINE
ada0p3 217G - - ONLINE
ada1p3 217G - - ONLINE
After:
$ zpool list -v -o name,size,alloc,free,health
NAME SIZE ALLOC FREE HEALTH
storage 43.7T 2.66M 43.7T ONLINE
raidz2-0 21.8T 1.30M 21.8T ONLINE
[...]
raidz2-1 21.8T 1.36M 21.8T ONLINE
[...]
spare - - - -
gpt/disk6 3.64T - - AVAIL
gpt/disk7 3.64T - - AVAIL
gpt/disk14 3.64T - - AVAIL
zroot 216G 1.40G 215G ONLINE
mirror-0 216G 1.40G 215G ONLINE
ada0p3 217G - - ONLINE
ada1p3 217G - - ONLINE
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
|
What's about log, dedup and special vdevs? They left without indentation. Also spare/cache is not really a vdev layer to have single indentation same as some raidz2. I feel we need some more universal scheme. |
This was purely a drive-by of the obvious ones as I was setting up a new pool, as the current formatting is a little misleading without any vertical spacing between pools. I guess my proposal would be bumping vdevs out by another two and using a |
@amotin I'm probably misunderstanding your comment, but I'd expect For example: # zpool list -v
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
tank 21.8T 480K 21.8T - - 0% 0% 1.00x ONLINE -
mirror-0 7.27T 0 7.27T - - 0% 0.00% - ONLINE
U70 7.28T - - - - - - - ONLINE
U71 7.28T - - - - - - - ONLINE
dedup - - - - - - - - -
U74 7.28T 0 7.27T - - 0% 0.00% - ONLINE
special - - - - - - - - -
U75 7.28T 480K 7.27T - - 0% 0.00% - ONLINE
logs - - - - - - - - -
U76 7.28T 0 7.27T - - 0% 0.00% - ONLINE
cache - - - - - - - - -
U73 7.28T 0 7.28T - - 0% 0.00% - ONLINE
spare - - - - - - - - -
U72 7.28T - - - - - - - AVAILAnd we'd want to give # zpool status -v
pool: tank1
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
tank1 ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
U70 ONLINE 0 0 0
U71 ONLINE 0 0 0
dedup
U74 ONLINE 0 0 0
special
U75 ONLINE 0 0 0
logs
U76 ONLINE 0 0 0
cache
U73 ONLINE 0 0 0
spares
U72 AVAIL
errors: No known data errors |
@behlendorf I agree that showing them with the same indentation as a pool is wrong. But neither I particularly like making the class names look as top-level vdevs, since the top-level vdevs in that case are |
Would it help to stylize them differently or something? Open to suggestions- I feel like I've stepped into a small hornet's nest that I'm not entirely qualified to poke at personally, but I'm willing to enact whatever you feel is best. |
That's fair, making them class names look like top-level vdevs is misleading as well. I'm not sure I have a great suggestion for how to improve the output. I'm open to suggestions, but until we can a concrete suggestion we're happy with I'd suggest we close this out. |
Motivation and Context
Normal vdevs come out right because of recursion into
collect_list_statswith a greater depth, but spare/cache details are emitted at the top-level and need a bit more of a nudge in indentation to avoid blending in with another zpool.Some details omitted for brevity. Before:
After:
Description
Give print_line() the ability to print indentation and take it into account for the name and use the appropriate depth for both, accounting for the fact that we're missing a level of depth being at the top-level.
How Has This Been Tested?
Ran on FreeBSD 15.1 with spares configured, doesn't really affect non-spare setupss.
Types of Changes
Checklist
Signed-off-by.