]> granicus.if.org Git - zfs/commitdiff
Add missing MMP status code to libzfs_status
authorbunder2015 <omfgbunder@gmail.com>
Thu, 3 Jan 2019 20:15:46 +0000 (15:15 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 3 Jan 2019 20:15:46 +0000 (12:15 -0800)
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

include/libzfs.h
lib/libzfs/libzfs_status.c
tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata3.ksh

index 762d57bef4eba2a31361e0229e27ef8e7a5b7ae4..c764e92dd50a00ac964c3640e64f56c4a066673f 100644 (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 */
index e49d79baaa4619b5ad41ba9357ee69173ef268b3..ebf497db6423cc2a965c5cdf753f4369dc6a7e11 100644 (file)
 
 /*
  * 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]))
index f4d97f147d67685976e1a3dc12580082d9e0b5c7..f51f81ce830467726b4afe42f26e0c21c4e16a32 100755 (executable)
@@ -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"