HomeFreeBSD

zpool import output is not formated properly.

Description

zpool import output is not formated properly.

The 'zpool status' output assumes that the longest prefix is six
character long plus colon plus space, eg. 'status: ', 'action: '
or 'config: ' (so eight in total). This works well even when we have
messages that requires more than one line, as '\t' is exactly eight
characters, just like the longest prefix.

The 'zpool import' output is a bit different, as it may display the
comment pool property, then the longest prefix is 'comment: ', which is
nine characters long, not eight.
All the prefixes were given an extra space in front, but:

  • 'status: ' did not get an extra space.
  • Messages that require more than one line should use nine spaces of indentation, not eight.
  • The extra space in front looks redundant if there is no comment property set on the given pool.

Fix it by adding an extra space to all prefixes, but only if the comment
property is defined. Also, when we need to continue the message in a new
line, use '\t ' for indentation.

While here, apply small corrections to a couple messages.

Before:

 pool: tank
   id: 7412636063178848859
state: ONLINE

status: Some supported features are not enabled on the pool.
(Note that they may be intentionally disabled if the
'compatibility' property is set.)
action: The pool can be imported using its name or numeric identif[...]
some features will not be available without an explicit 'zp[...]
comment: Example comment.
config:

bclone ONLINE

	  ada0      ONLINE

After:

pool: tank
  id: 10180960571062436759

state: ONLINE
status: Some supported features are not enabled on the pool.
(Note that they may be intentionally disabled if the
'compatibility' property is set.)
action: The pool can be imported using its name or numeric identifi[...]
some features will not be available without an explicit 'zp[...]
config:

tank ONLINE

	  ada3      ONLINE

   pool: dozer
     id: 11028319538368222579
  state: ONLINE

status: Some supported features are not enabled on the pool.

	 (Note that they may be intentionally disabled if the
	 'compatibility' property is set.)

action: The pool can be imported using its name or numeric identif[...]

	 some features will not be available without an explicit 'z[...]

comment: Example comment.
config:

dozer ONLINE

	  ada1      ONLINE

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Dawidek <pawel@dawidek.net>
Closes #16128

Details

Provenance
pjdAuthored on May 29 2024, 8:34 PM
GitHub <noreply@github.com>Committed on May 29 2024, 8:34 PM
Parents
rGae22044da998: spl: fix compilation without HAVE_BACKTRACE
Branches
Unknown
Tags
Unknown