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
This commit is contained in:
Pawel Jakub Dawidek 2024-05-29 13:34:59 -07:00 committed by GitHub
parent ae22044da9
commit 5137c132a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3016,6 +3016,7 @@ show_import(nvlist_t *config, boolean_t report_error)
const char *health; const char *health;
uint_t vsc; uint_t vsc;
const char *comment; const char *comment;
const char *indent;
status_cbdata_t cb = { 0 }; status_cbdata_t cb = { 0 };
verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME,
@ -3040,82 +3041,84 @@ show_import(nvlist_t *config, boolean_t report_error)
if (reason != ZPOOL_STATUS_OK && !report_error) if (reason != ZPOOL_STATUS_OK && !report_error)
return (reason); return (reason);
(void) printf(gettext(" pool: %s\n"), name); if (nvlist_lookup_string(config, ZPOOL_CONFIG_COMMENT, &comment) == 0) {
(void) printf(gettext(" id: %llu\n"), (u_longlong_t)guid); indent = " ";
(void) printf(gettext(" state: %s"), health); } else {
comment = NULL;
indent = "";
}
(void) printf(gettext("%s pool: %s\n"), indent, name);
(void) printf(gettext("%s id: %llu\n"), indent, (u_longlong_t)guid);
(void) printf(gettext("%s state: %s"), indent, health);
if (pool_state == POOL_STATE_DESTROYED) if (pool_state == POOL_STATE_DESTROYED)
(void) printf(gettext(" (DESTROYED)")); (void) printf(gettext(" (DESTROYED)"));
(void) printf("\n"); (void) printf("\n");
if (reason != ZPOOL_STATUS_OK) {
(void) printf("%s", indent);
printf_color(ANSI_BOLD, gettext("status: "));
}
switch (reason) { switch (reason) {
case ZPOOL_STATUS_MISSING_DEV_R: case ZPOOL_STATUS_MISSING_DEV_R:
case ZPOOL_STATUS_MISSING_DEV_NR: case ZPOOL_STATUS_MISSING_DEV_NR:
case ZPOOL_STATUS_BAD_GUID_SUM: case ZPOOL_STATUS_BAD_GUID_SUM:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("One or more devices are " printf_color(ANSI_YELLOW, gettext("One or more devices are "
"missing from the system.\n")); "missing from the system.\n"));
break; break;
case ZPOOL_STATUS_CORRUPT_LABEL_R: case ZPOOL_STATUS_CORRUPT_LABEL_R:
case ZPOOL_STATUS_CORRUPT_LABEL_NR: case ZPOOL_STATUS_CORRUPT_LABEL_NR:
printf_color(ANSI_BOLD, gettext("status: ")); printf_color(ANSI_YELLOW, gettext("One or more devices "
printf_color(ANSI_YELLOW, gettext("One or more devices contains" "contains corrupted data.\n"));
" corrupted data.\n"));
break; break;
case ZPOOL_STATUS_CORRUPT_DATA: case ZPOOL_STATUS_CORRUPT_DATA:
(void) printf( printf_color(ANSI_YELLOW, gettext("The pool data is "
gettext(" status: The pool data is corrupted.\n")); "corrupted.\n"));
break; break;
case ZPOOL_STATUS_OFFLINE_DEV: case ZPOOL_STATUS_OFFLINE_DEV:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("One or more devices " printf_color(ANSI_YELLOW, gettext("One or more devices "
"are offlined.\n")); "are offlined.\n"));
break; break;
case ZPOOL_STATUS_CORRUPT_POOL: case ZPOOL_STATUS_CORRUPT_POOL:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("The pool metadata is " printf_color(ANSI_YELLOW, gettext("The pool metadata is "
"corrupted.\n")); "corrupted.\n"));
break; break;
case ZPOOL_STATUS_VERSION_OLDER: case ZPOOL_STATUS_VERSION_OLDER:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("The pool is formatted using " printf_color(ANSI_YELLOW, gettext("The pool is formatted using "
"a legacy on-disk version.\n")); "a legacy on-disk version.\n"));
break; break;
case ZPOOL_STATUS_VERSION_NEWER: case ZPOOL_STATUS_VERSION_NEWER:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("The pool is formatted using " printf_color(ANSI_YELLOW, gettext("The pool is formatted using "
"an incompatible version.\n")); "an incompatible version.\n"));
break; break;
case ZPOOL_STATUS_FEAT_DISABLED: case ZPOOL_STATUS_FEAT_DISABLED:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("Some supported " printf_color(ANSI_YELLOW, gettext("Some supported "
"features are not enabled on the pool.\n\t" "features are not enabled on the pool.\n"
"(Note that they may be intentionally disabled " "\t%s(Note that they may be intentionally disabled if the\n"
"if the\n\t'compatibility' property is set.)\n")); "\t%s'compatibility' property is set.)\n"), indent, indent);
break; break;
case ZPOOL_STATUS_COMPATIBILITY_ERR: case ZPOOL_STATUS_COMPATIBILITY_ERR:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("Error reading or parsing " printf_color(ANSI_YELLOW, gettext("Error reading or parsing "
"the file(s) indicated by the 'compatibility'\n" "the file(s) indicated by the 'compatibility'\n"
"property.\n")); "\t%sproperty.\n"), indent);
break; break;
case ZPOOL_STATUS_INCOMPATIBLE_FEAT: case ZPOOL_STATUS_INCOMPATIBLE_FEAT:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("One or more features " printf_color(ANSI_YELLOW, gettext("One or more features "
"are enabled on the pool despite not being\n" "are enabled on the pool despite not being\n"
"requested by the 'compatibility' property.\n")); "\t%srequested by the 'compatibility' property.\n"),
indent);
break; break;
case ZPOOL_STATUS_UNSUP_FEAT_READ: case ZPOOL_STATUS_UNSUP_FEAT_READ:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("The pool uses the following " printf_color(ANSI_YELLOW, gettext("The pool uses the following "
"feature(s) not supported on this system:\n")); "feature(s) not supported on this system:\n"));
color_start(ANSI_YELLOW); color_start(ANSI_YELLOW);
@ -3124,66 +3127,60 @@ show_import(nvlist_t *config, boolean_t report_error)
break; break;
case ZPOOL_STATUS_UNSUP_FEAT_WRITE: case ZPOOL_STATUS_UNSUP_FEAT_WRITE:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("The pool can only be " printf_color(ANSI_YELLOW, gettext("The pool can only be "
"accessed in read-only mode on this system. It\n\tcannot be" "accessed in read-only mode on this system. It\n"
" accessed in read-write mode because it uses the " "\t%scannot be accessed in read-write mode because it uses "
"following\n\tfeature(s) not supported on this system:\n")); "the following\n"
"\t%sfeature(s) not supported on this system:\n"),
indent, indent);
color_start(ANSI_YELLOW); color_start(ANSI_YELLOW);
zpool_print_unsup_feat(config); zpool_print_unsup_feat(config);
color_end(); color_end();
break; break;
case ZPOOL_STATUS_HOSTID_ACTIVE: case ZPOOL_STATUS_HOSTID_ACTIVE:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("The pool is currently " printf_color(ANSI_YELLOW, gettext("The pool is currently "
"imported by another system.\n")); "imported by another system.\n"));
break; break;
case ZPOOL_STATUS_HOSTID_REQUIRED: case ZPOOL_STATUS_HOSTID_REQUIRED:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("The pool has the " printf_color(ANSI_YELLOW, gettext("The pool has the "
"multihost property on. It cannot\n\tbe safely imported " "multihost property on. It cannot\n"
"when the system hostid is not set.\n")); "\t%sbe safely imported when the system hostid is not "
"set.\n"), indent);
break; break;
case ZPOOL_STATUS_HOSTID_MISMATCH: case ZPOOL_STATUS_HOSTID_MISMATCH:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("The pool was last accessed " printf_color(ANSI_YELLOW, gettext("The pool was last accessed "
"by another system.\n")); "by another system.\n"));
break; break;
case ZPOOL_STATUS_FAULTED_DEV_R: case ZPOOL_STATUS_FAULTED_DEV_R:
case ZPOOL_STATUS_FAULTED_DEV_NR: case ZPOOL_STATUS_FAULTED_DEV_NR:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("One or more devices are " printf_color(ANSI_YELLOW, gettext("One or more devices are "
"faulted.\n")); "faulted.\n"));
break; break;
case ZPOOL_STATUS_BAD_LOG: case ZPOOL_STATUS_BAD_LOG:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("An intent log record cannot " printf_color(ANSI_YELLOW, gettext("An intent log record cannot "
"be read.\n")); "be read.\n"));
break; break;
case ZPOOL_STATUS_RESILVERING: case ZPOOL_STATUS_RESILVERING:
case ZPOOL_STATUS_REBUILDING: case ZPOOL_STATUS_REBUILDING:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("One or more devices were " printf_color(ANSI_YELLOW, gettext("One or more devices were "
"being resilvered.\n")); "being resilvered.\n"));
break; break;
case ZPOOL_STATUS_ERRATA: case ZPOOL_STATUS_ERRATA:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("Errata #%d detected.\n"), printf_color(ANSI_YELLOW, gettext("Errata #%d detected.\n"),
errata); errata);
break; break;
case ZPOOL_STATUS_NON_NATIVE_ASHIFT: case ZPOOL_STATUS_NON_NATIVE_ASHIFT:
printf_color(ANSI_BOLD, gettext("status: "));
printf_color(ANSI_YELLOW, gettext("One or more devices are " printf_color(ANSI_YELLOW, gettext("One or more devices are "
"configured to use a non-native block size.\n" "configured to use a non-native block size.\n"
"\tExpect reduced performance.\n")); "\t%sExpect reduced performance.\n"), indent);
break; break;
default: default:
@ -3196,114 +3193,121 @@ show_import(nvlist_t *config, boolean_t report_error)
/* /*
* Print out an action according to the overall state of the pool. * Print out an action according to the overall state of the pool.
*/ */
if (vs->vs_state != VDEV_STATE_HEALTHY ||
reason != ZPOOL_STATUS_ERRATA || errata != ZPOOL_ERRATA_NONE) {
(void) printf("%s", indent);
(void) printf(gettext("action: "));
}
if (vs->vs_state == VDEV_STATE_HEALTHY) { if (vs->vs_state == VDEV_STATE_HEALTHY) {
if (reason == ZPOOL_STATUS_VERSION_OLDER || if (reason == ZPOOL_STATUS_VERSION_OLDER ||
reason == ZPOOL_STATUS_FEAT_DISABLED) { reason == ZPOOL_STATUS_FEAT_DISABLED) {
(void) printf(gettext(" action: The pool can be " (void) printf(gettext("The pool can be imported using "
"imported using its name or numeric identifier, " "its name or numeric identifier, though\n"
"though\n\tsome features will not be available " "\t%ssome features will not be available without "
"without an explicit 'zpool upgrade'.\n")); "an explicit 'zpool upgrade'.\n"), indent);
} else if (reason == ZPOOL_STATUS_COMPATIBILITY_ERR) { } else if (reason == ZPOOL_STATUS_COMPATIBILITY_ERR) {
(void) printf(gettext(" action: The pool can be " (void) printf(gettext("The pool can be imported using "
"imported using its name or numeric\n\tidentifier, " "its name or numeric\n"
"though the file(s) indicated by its " "\t%sidentifier, though the file(s) indicated by "
"'compatibility'\n\tproperty cannot be parsed at " "its 'compatibility'\n"
"this time.\n")); "\t%sproperty cannot be parsed at this time.\n"),
indent, indent);
} else if (reason == ZPOOL_STATUS_HOSTID_MISMATCH) { } else if (reason == ZPOOL_STATUS_HOSTID_MISMATCH) {
(void) printf(gettext(" action: The pool can be " (void) printf(gettext("The pool can be imported using "
"imported using its name or numeric " "its name or numeric identifier and\n"
"identifier and\n\tthe '-f' flag.\n")); "\t%sthe '-f' flag.\n"), indent);
} else if (reason == ZPOOL_STATUS_ERRATA) { } else if (reason == ZPOOL_STATUS_ERRATA) {
switch (errata) { switch (errata) {
case ZPOOL_ERRATA_NONE:
break;
case ZPOOL_ERRATA_ZOL_2094_SCRUB: case ZPOOL_ERRATA_ZOL_2094_SCRUB:
(void) printf(gettext(" action: The pool can " (void) printf(gettext("The pool can be "
"be imported using its name or numeric " "imported using its name or numeric "
"identifier,\n\thowever there is a compat" "identifier,\n"
"ibility issue which should be corrected" "\t%showever there is a compatibility "
"\n\tby running 'zpool scrub'\n")); "issue which should be corrected\n"
"\t%sby running 'zpool scrub'\n"),
indent, indent);
break; break;
case ZPOOL_ERRATA_ZOL_2094_ASYNC_DESTROY: case ZPOOL_ERRATA_ZOL_2094_ASYNC_DESTROY:
(void) printf(gettext(" action: The pool can" (void) printf(gettext("The pool cannot be "
"not be imported with this version of ZFS " "imported with this version of ZFS due to\n"
"due to\n\tan active asynchronous destroy. " "\t%san active asynchronous destroy. "
"Revert to an earlier version\n\tand " "Revert to an earlier version\n"
"allow the destroy to complete before " "\t%sand allow the destroy to complete "
"updating.\n")); "before updating.\n"), indent, indent);
break; break;
case ZPOOL_ERRATA_ZOL_6845_ENCRYPTION: case ZPOOL_ERRATA_ZOL_6845_ENCRYPTION:
(void) printf(gettext(" action: Existing " (void) printf(gettext("Existing encrypted "
"encrypted datasets contain an on-disk " "datasets contain an on-disk "
"incompatibility, which\n\tneeds to be " "incompatibility, which\n"
"corrected. Backup these datasets to new " "\t%sneeds to be corrected. Backup these "
"encrypted datasets\n\tand destroy the " "datasets to new encrypted datasets\n"
"old ones.\n")); "\t%sand destroy the old ones.\n"),
indent, indent);
break; break;
case ZPOOL_ERRATA_ZOL_8308_ENCRYPTION: case ZPOOL_ERRATA_ZOL_8308_ENCRYPTION:
(void) printf(gettext(" action: Existing " (void) printf(gettext("Existing encrypted "
"encrypted snapshots and bookmarks contain " "snapshots and bookmarks contain an "
"an on-disk\n\tincompatibility. This may " "on-disk\n"
"cause on-disk corruption if they are used" "\t%sincompatibility. This may cause "
"\n\twith 'zfs recv'. To correct the " "on-disk corruption if they are used\n"
"issue, enable the bookmark_v2 feature.\n\t" "\t%swith 'zfs recv'. To correct the "
"No additional action is needed if there " "issue, enable the bookmark_v2 feature.\n"
"are no encrypted snapshots or\n\t" "\t%sNo additional action is needed if "
"bookmarks. If preserving the encrypted " "there are no encrypted snapshots or\n"
"snapshots and bookmarks is\n\trequired, " "\t%sbookmarks. If preserving the "
"use a non-raw send to backup and restore " "encrypted snapshots and bookmarks is\n"
"them. Alternately,\n\tthey may be removed" "\t%srequired, use a non-raw send to "
" to resolve the incompatibility.\n")); "backup and restore them. Alternately,\n"
"\t%sthey may be removed to resolve the "
"incompatibility.\n"), indent, indent,
indent, indent, indent, indent);
break; break;
default: default:
/* /*
* All errata must contain an action message. * All errata must contain an action message.
*/ */
assert(0); assert(errata == ZPOOL_ERRATA_NONE);
} }
} else { } else {
(void) printf(gettext(" action: The pool can be " (void) printf(gettext("The pool can be imported using "
"imported using its name or numeric " "its name or numeric identifier.\n"));
"identifier.\n"));
} }
} else if (vs->vs_state == VDEV_STATE_DEGRADED) { } else if (vs->vs_state == VDEV_STATE_DEGRADED) {
(void) printf(gettext(" action: The pool can be imported " (void) printf(gettext("The pool can be imported despite "
"despite missing or damaged devices. The\n\tfault " "missing or damaged devices. The\n"
"tolerance of the pool may be compromised if imported.\n")); "\t%sfault tolerance of the pool may be compromised if "
"imported.\n"), indent);
} else { } else {
switch (reason) { switch (reason) {
case ZPOOL_STATUS_VERSION_NEWER: case ZPOOL_STATUS_VERSION_NEWER:
(void) printf(gettext(" action: The pool cannot be " (void) printf(gettext("The pool cannot be imported. "
"imported. Access the pool on a system running " "Access the pool on a system running newer\n"
"newer\n\tsoftware, or recreate the pool from " "\t%ssoftware, or recreate the pool from "
"backup.\n")); "backup.\n"), indent);
break; break;
case ZPOOL_STATUS_UNSUP_FEAT_READ: case ZPOOL_STATUS_UNSUP_FEAT_READ:
printf_color(ANSI_BOLD, gettext("action: ")); (void) printf(gettext("The pool cannot be imported. "
printf_color(ANSI_YELLOW, gettext("The pool cannot be " "Access the pool on a system that supports\n"
"imported. Access the pool on a system that " "\t%sthe required feature(s), or recreate the pool "
"supports\n\tthe required feature(s), or recreate " "from backup.\n"), indent);
"the pool from backup.\n"));
break; break;
case ZPOOL_STATUS_UNSUP_FEAT_WRITE: case ZPOOL_STATUS_UNSUP_FEAT_WRITE:
printf_color(ANSI_BOLD, gettext("action: ")); (void) printf(gettext("The pool cannot be imported in "
printf_color(ANSI_YELLOW, gettext("The pool cannot be " "read-write mode. Import the pool with\n"
"imported in read-write mode. Import the pool " "\t%s'-o readonly=on', access the pool on a system "
"with\n" "that supports the\n"
"\t\"-o readonly=on\", access the pool on a system " "\t%srequired feature(s), or recreate the pool "
"that supports the\n\trequired feature(s), or " "from backup.\n"), indent, indent);
"recreate the pool from backup.\n"));
break; break;
case ZPOOL_STATUS_MISSING_DEV_R: case ZPOOL_STATUS_MISSING_DEV_R:
case ZPOOL_STATUS_MISSING_DEV_NR: case ZPOOL_STATUS_MISSING_DEV_NR:
case ZPOOL_STATUS_BAD_GUID_SUM: case ZPOOL_STATUS_BAD_GUID_SUM:
(void) printf(gettext(" action: The pool cannot be " (void) printf(gettext("The pool cannot be imported. "
"imported. Attach the missing\n\tdevices and try " "Attach the missing\n"
"again.\n")); "\t%sdevices and try again.\n"), indent);
break; break;
case ZPOOL_STATUS_HOSTID_ACTIVE: case ZPOOL_STATUS_HOSTID_ACTIVE:
VERIFY0(nvlist_lookup_nvlist(config, VERIFY0(nvlist_lookup_nvlist(config,
@ -3317,47 +3321,49 @@ show_import(nvlist_t *config, boolean_t report_error)
hostid = fnvlist_lookup_uint64(nvinfo, hostid = fnvlist_lookup_uint64(nvinfo,
ZPOOL_CONFIG_MMP_HOSTID); ZPOOL_CONFIG_MMP_HOSTID);
(void) printf(gettext(" action: The pool must be " (void) printf(gettext("The pool must be exported from "
"exported from %s (hostid=%"PRIx64")\n\tbefore it " "%s (hostid=%"PRIx64")\n"
"can be safely imported.\n"), hostname, hostid); "\t%sbefore it can be safely imported.\n"),
hostname, hostid, indent);
break; break;
case ZPOOL_STATUS_HOSTID_REQUIRED: case ZPOOL_STATUS_HOSTID_REQUIRED:
(void) printf(gettext(" action: Set a unique system " (void) printf(gettext("Set a unique system hostid with "
"hostid with the zgenhostid(8) command.\n")); "the zgenhostid(8) command.\n"));
break; break;
default: default:
(void) printf(gettext(" action: The pool cannot be " (void) printf(gettext("The pool cannot be imported due "
"imported due to damaged devices or data.\n")); "to damaged devices or data.\n"));
} }
} }
/* Print the comment attached to the pool. */ /* Print the comment attached to the pool. */
if (nvlist_lookup_string(config, ZPOOL_CONFIG_COMMENT, &comment) == 0) if (comment != NULL)
(void) printf(gettext("comment: %s\n"), comment); (void) printf(gettext("comment: %s\n"), comment);
/* /*
* If the state is "closed" or "can't open", and the aux state * If the state is "closed" or "can't open", and the aux state
* is "corrupt data": * is "corrupt data":
*/ */
if (((vs->vs_state == VDEV_STATE_CLOSED) || if ((vs->vs_state == VDEV_STATE_CLOSED ||
(vs->vs_state == VDEV_STATE_CANT_OPEN)) && vs->vs_state == VDEV_STATE_CANT_OPEN) &&
(vs->vs_aux == VDEV_AUX_CORRUPT_DATA)) { vs->vs_aux == VDEV_AUX_CORRUPT_DATA) {
if (pool_state == POOL_STATE_DESTROYED) if (pool_state == POOL_STATE_DESTROYED)
(void) printf(gettext("\tThe pool was destroyed, " (void) printf(gettext("\t%sThe pool was destroyed, "
"but can be imported using the '-Df' flags.\n")); "but can be imported using the '-Df' flags.\n"),
indent);
else if (pool_state != POOL_STATE_EXPORTED) else if (pool_state != POOL_STATE_EXPORTED)
(void) printf(gettext("\tThe pool may be active on " (void) printf(gettext("\t%sThe pool may be active on "
"another system, but can be imported using\n\t" "another system, but can be imported using\n"
"the '-f' flag.\n")); "\t%sthe '-f' flag.\n"), indent, indent);
} }
if (msgid != NULL) { if (msgid != NULL) {
(void) printf(gettext( (void) printf(gettext("%s see: "
" see: https://openzfs.github.io/openzfs-docs/msg/%s\n"), "https://openzfs.github.io/openzfs-docs/msg/%s\n"),
msgid); indent, msgid);
} }
(void) printf(gettext(" config:\n\n")); (void) printf(gettext("%sconfig:\n\n"), indent);
cb.cb_namewidth = max_width(NULL, nvroot, 0, strlen(name), cb.cb_namewidth = max_width(NULL, nvroot, 0, strlen(name),
VDEV_NAME_TYPE_ID); VDEV_NAME_TYPE_ID);
@ -3371,9 +3377,10 @@ show_import(nvlist_t *config, boolean_t report_error)
print_class_vdevs(NULL, &cb, nvroot, VDEV_ALLOC_CLASS_LOGS); print_class_vdevs(NULL, &cb, nvroot, VDEV_ALLOC_CLASS_LOGS);
if (reason == ZPOOL_STATUS_BAD_GUID_SUM) { if (reason == ZPOOL_STATUS_BAD_GUID_SUM) {
(void) printf(gettext("\n\tAdditional devices are known to " (void) printf(gettext("\n\t%sAdditional devices are known to "
"be part of this pool, though their\n\texact " "be part of this pool, though their\n"
"configuration cannot be determined.\n")); "\t%sexact configuration cannot be determined.\n"),
indent, indent);
} }
return (0); return (0);
} }