Add missing MMP status code to libzfs_status

When MMP was merged the status codes in libzfs_status were not
updated to add the status code for ZPOOL_STATUS_IO_FAILURE_MMP.  This
commit corrects this and adds comments to help keep track of which
code is used for which status.

Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: bunder2015 <omfgbunder@gmail.com>
Closes #8148
Closes #8222
This commit is contained in:
bunder2015 2019-01-03 15:15:46 -05:00 committed by Brian Behlendorf
parent 65ca2c1eb9
commit 5365b0747a
3 changed files with 39 additions and 21 deletions

View File

@ -303,6 +303,8 @@ typedef enum {
/*
* The following correspond to faults as defined in the (fault.fs.zfs.*)
* event namespace. Each is associated with a corresponding message ID.
* This must be kept in sync with the zfs_msgid_table in
* lib/libzfs/libzfs_status.c.
*/
ZPOOL_STATUS_CORRUPT_CACHE, /* corrupt /kernel/drv/zpool.cache */
ZPOOL_STATUS_MISSING_DEV_R, /* missing device with replicas */

View File

@ -51,27 +51,41 @@
/*
* Message ID table. This must be kept in sync with the ZPOOL_STATUS_* defines
* in libzfs.h. Note that there are some status results which go past the end
* of this table, and hence have no associated message ID.
* in include/libzfs.h. Note that there are some status results which go past
* the end of this table, and hence have no associated message ID.
*/
static char *zfs_msgid_table[] = {
"ZFS-8000-14",
"ZFS-8000-2Q",
"ZFS-8000-3C",
"ZFS-8000-4J",
"ZFS-8000-5E",
"ZFS-8000-6X",
"ZFS-8000-72",
"ZFS-8000-8A",
"ZFS-8000-9P",
"ZFS-8000-A5",
"ZFS-8000-EY",
"ZFS-8000-EY",
"ZFS-8000-EY",
"ZFS-8000-HC",
"ZFS-8000-JQ",
"ZFS-8000-K4",
"ZFS-8000-ER",
"ZFS-8000-14", /* ZPOOL_STATUS_CORRUPT_CACHE */
"ZFS-8000-2Q", /* ZPOOL_STATUS_MISSING_DEV_R */
"ZFS-8000-3C", /* ZPOOL_STATUS_MISSING_DEV_NR */
"ZFS-8000-4J", /* ZPOOL_STATUS_CORRUPT_LABEL_R */
"ZFS-8000-5E", /* ZPOOL_STATUS_CORRUPT_LABEL_NR */
"ZFS-8000-6X", /* ZPOOL_STATUS_BAD_GUID_SUM */
"ZFS-8000-72", /* ZPOOL_STATUS_CORRUPT_POOL */
"ZFS-8000-8A", /* ZPOOL_STATUS_CORRUPT_DATA */
"ZFS-8000-9P", /* ZPOOL_STATUS_FAILING_DEV */
"ZFS-8000-A5", /* ZPOOL_STATUS_VERSION_NEWER */
"ZFS-8000-EY", /* ZPOOL_STATUS_HOSTID_MISMATCH */
"ZFS-8000-EY", /* ZPOOL_STATUS_HOSTID_ACTIVE */
"ZFS-8000-EY", /* ZPOOL_STATUS_HOSTID_REQUIRED */
"ZFS-8000-HC", /* ZPOOL_STATUS_IO_FAILURE_WAIT */
"ZFS-8000-JQ", /* ZPOOL_STATUS_IO_FAILURE_CONTINUE */
"ZFS-8000-MM", /* ZPOOL_STATUS_IO_FAILURE_MMP */
"ZFS-8000-K4", /* ZPOOL_STATUS_BAD_LOG */
"ZFS-8000-ER", /* ZPOOL_STATUS_ERRATA */
/*
* The following results have no message ID.
* ZPOOL_STATUS_UNSUP_FEAT_READ
* ZPOOL_STATUS_UNSUP_FEAT_WRITE
* ZPOOL_STATUS_FAULTED_DEV_R
* ZPOOL_STATUS_FAULTED_DEV_NR
* ZPOOL_STATUS_VERSION_OLDER
* ZPOOL_STATUS_FEAT_DISABLED
* ZPOOL_STATUS_RESILVERING
* ZPOOL_STATUS_OFFLINE_DEV
* ZPOOL_STATUS_REMOVED_DEV
* ZPOOL_STATUS_OK
*/
};
#define NMSGID (sizeof (zfs_msgid_table) / sizeof (zfs_msgid_table[0]))

View File

@ -62,7 +62,8 @@ log_assert "Verify that Errata 3 is properly handled"
uncompress_pool
log_must zpool import -d /$TESTPOOL/ $POOL_NAME
log_must eval "zpool status | grep -q Errata"
log_must eval "zpool status $POOL_NAME | grep -q Errata"
log_must eval "zpool status $POOL_NAME | grep -q ZFS-8000-ER"
log_must eval "echo 'password' | zfs load-key $POOL_NAME/testfs"
log_must eval "echo 'password' | zfs load-key $POOL_NAME/testvol"
@ -95,5 +96,6 @@ log_must zfs destroy -r $POOL_NAME/testvol
log_must zpool export $POOL_NAME
log_must zpool import -d /$TESTPOOL/ $POOL_NAME
log_mustnot eval "zpool status | grep -q Errata"
log_mustnot eval "zpool status $POOL_NAME | grep -q Errata"
log_mustnot eval "zpool status $POOL_NAME | grep -q ZFS-8000-ER"
log_pass "Errata 3 is properly handled"