-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 'zpool list -v' alignment #8147
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8147 +/- ##
==========================================
+ Coverage 78.45% 78.61% +0.16%
==========================================
Files 378 378
Lines 114765 114786 +21
==========================================
+ Hits 90035 90244 +209
+ Misses 24730 24542 -188
Continue to review full report at Codecov.
|
This may be outside the scope of this fixup, but you might want to consider fixing the
|
cmd/zpool/zpool_main.c
Outdated
int | ||
get_namewidth(zpool_handle_t *zhp, void *data) | ||
static int | ||
get_namewidth(zpool_handle_t *zhp, int *width, int flags, boolean_t verbose) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- What about having
get_namewidth()
return the width instead of having a separate*width
? - Can you add a quick comment above the function deceleration:
/* Return the length of the pool/vdev name column. */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, after reworking things a little more I think that'll work.
f7b518c
to
e2a573b
Compare
Refreshed. and feedback addressed.
I'd rather leave this alone to make sure we don't break anything parsing this output. The documentation clearly states the output will print the columns separated by a single tab.
I've also re-added the ALTROOT line to the output. Several helper functions in the ZTS look for this column and its absence resulted in test failures. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't completely understand all of the formatting, but at a glance it looks good. The commit comment has a typo: Minimally update the code the correct the alignment using the same strategy employedby 'zpool status'.
The verbose output of 'zpool list' was not correctly aligned due to differences in the vdev name lengths. Minimally update the code the correct the alignment using the same strategy employed by 'zpool status'. Missing dashes were added for the empty defaults columns, and the vdev state is now printed for all vdevs. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
e2a573b
to
3fe2e50
Compare
The verbose output of 'zpool list' was not correctly aligned due to differences in the vdev name lengths. Minimally update the code the correct the alignment using the same strategy employed by 'zpool status'. Missing dashes were added for the empty defaults columns, and the vdev state is now printed for all vdevs. Reviewed-by: Tom Caputi <tcaputi@datto.com> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#7308 Closes openzfs#8147
Motivation and Context
Issue #7308. The current output of
zpool list -v
does a terriblejob properly aligning its output. We want to correct that so it's
easy to read at a glance. This change only tackles the major
cosmetic issues and intentionally avoids any extensive refactoring.
There's quite a bit more which could be improved.
Description
The verbose output of 'zpool list' was not correctly aligned due
to differences in the vdev name lengths. Minimally update the
code the correct the alignment using the same strategy employed
by 'zpool status'.
Missing dashes were added for the empty defaults columns, and
the vdev state is now printed for all vdevs.
The ALTROOT properly was removed from the default output to get
close to staying within an 80 character width. At least for
short vdev names.
How Has This Been Tested?
Manually inspected the output for a moderating interesting pool configuration.
BEFORE:
AFTER:
Types of changes
Checklist:
Signed-off-by
.