summaryrefslogtreecommitdiffstats
path: root/cmd/zpool/zpool_main.c
diff options
context:
space:
mode:
authorDon Brady <[email protected]>2016-08-31 15:46:58 -0600
committerBrian Behlendorf <[email protected]>2016-09-01 11:39:45 -0700
commitd02ca379795a37b8541da5a1b37528f7130de1e6 (patch)
tree67167cfd23f15abeccefe553400bf37dd1032399 /cmd/zpool/zpool_main.c
parent0b284702b75aa712a7d1353b93e19d5b2c783f27 (diff)
Bring over illumos ZFS FMA logic -- phase 1
This first phase brings over the ZFS SLM module, zfs_mod.c, to handle auto operations in response to disk events. Disk event monitoring is provided from libudev and generates the expected payload schema for zfs_mod. This work leverages the recently added devid and phys_path strings in the vdev label. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Don Brady <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #4673
Diffstat (limited to 'cmd/zpool/zpool_main.c')
-rw-r--r--cmd/zpool/zpool_main.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index 9041f9c33..09531b21d 100644
--- a/cmd/zpool/zpool_main.c
+++ b/cmd/zpool/zpool_main.c
@@ -47,6 +47,7 @@
#include <zfs_prop.h>
#include <sys/fs/zfs.h>
#include <sys/stat.h>
+#include <sys/fm/fs/zfs.h>
#include <sys/fm/util.h>
#include <sys/fm/protocol.h>
#include <sys/zfs_ioctl.h>
@@ -6849,7 +6850,20 @@ zpool_do_events_nvprint(nvlist_t *nvl, int depth)
case DATA_TYPE_UINT64:
(void) nvpair_value_uint64(nvp, &i64);
- printf(gettext("0x%llx"), (u_longlong_t)i64);
+ /*
+ * translate vdev state values to readable
+ * strings to aide zpool events consumers
+ */
+ if (strcmp(name,
+ FM_EREPORT_PAYLOAD_ZFS_VDEV_STATE) == 0 ||
+ strcmp(name,
+ FM_EREPORT_PAYLOAD_ZFS_VDEV_LASTSTATE) == 0) {
+ printf(gettext("\"%s\" (0x%llx)"),
+ zpool_state_to_name(i64, VDEV_AUX_NONE),
+ (u_longlong_t)i64);
+ } else {
+ printf(gettext("0x%llx"), (u_longlong_t)i64);
+ }
break;
case DATA_TYPE_HRTIME: