zed.d/generic-notify.sh \
zed.d/io-notify.sh \
zed.d/io-spare.sh \
- zed.d/resilver.finish-notify.sh \
- zed.d/scrub.finish-notify.sh
+ zed.d/resilver_finish-notify.sh \
+ zed.d/scrub_finish-notify.sh
zedconfdefaults = \
all-syslog.sh \
data-notify.sh \
io-notify.sh \
io-spare.sh \
- resilver.finish-notify.sh \
- scrub.finish-notify.sh
+ resilver_finish-notify.sh \
+ scrub_finish-notify.sh
install-data-hook:
$(MKDIR_P) "$(DESTDIR)$(zedconfdir)"
+++ /dev/null
-scrub.finish-notify.sh
\ No newline at end of file
--- /dev/null
+scrub_finish-notify.sh
\ No newline at end of file
#!/bin/sh
#
-# Send notification in response to a RESILVER.FINISH or SCRUB.FINISH.
+# Send notification in response to a RESILVER_FINISH or SCRUB_FINISH.
#
-# By default, "zpool status" output will only be included for a scrub.finish
+# By default, "zpool status" output will only be included for a scrub_finish
# zevent if the pool is not healthy; to always include its output, set
# ZED_NOTIFY_VERBOSE=1.
#
[ -n "${ZEVENT_POOL}" ] || exit 9
[ -n "${ZEVENT_SUBCLASS}" ] || exit 9
-if [ "${ZEVENT_SUBCLASS}" = "resilver.finish" ]; then
+if [ "${ZEVENT_SUBCLASS}" = "resilver_finish" ]; then
action="resilver"
-elif [ "${ZEVENT_SUBCLASS}" = "scrub.finish" ]; then
+elif [ "${ZEVENT_SUBCLASS}" = "scrub_finish" ]; then
action="scrub"
else
zed_log_err "unsupported event class \"${ZEVENT_SUBCLASS}\""
# For scrub, suppress notification if the pool is healthy
# and verbosity is not enabled.
#
-if [ "${ZEVENT_SUBCLASS}" = "scrub.finish" ]; then
+if [ "${ZEVENT_SUBCLASS}" = "scrub_finish" ]; then
healthy="$("${ZPOOL}" status -x "${ZEVENT_POOL}" \
| grep "'${ZEVENT_POOL}' is healthy")"
[ -n "${healthy}" ] && [ "${ZED_NOTIFY_VERBOSE}" -eq 0 ] && exit 3
/*
* Compute the "subclass" by removing the first 3 components of [class]
- * (which seem to always be either "ereport.fs.zfs" or "resource.fs.zfs").
- * Return a pointer inside the string [class], or NULL if insufficient
- * components exist.
+ * (which will always be of the form "*.fs.zfs"). Return a pointer inside
+ * the string [class], or NULL if insufficient components exist.
*/
static const char *
_zed_event_get_subclass(const char *class)
lib/libspl/include/ia32/sys/Makefile
lib/libspl/include/rpc/Makefile
lib/libspl/include/sys/Makefile
- lib/libspl/include/sys/sysevent/Makefile
lib/libspl/include/sys/dktp/Makefile
lib/libspl/include/util/Makefile
lib/libavl/Makefile
include/sys/fm/Makefile
include/sys/fm/fs/Makefile
include/sys/crypto/Makefile
+ include/sys/sysevent/Makefile
scripts/Makefile
scripts/zpios-profile/Makefile
scripts/zpios-test/Makefile
-SUBDIRS = fm fs crypto
+SUBDIRS = fm fs crypto sysevent
COMMON_H = \
$(top_srcdir)/include/sys/arc.h \
$(top_srcdir)/include/sys/spa.h \
$(top_srcdir)/include/sys/spa_impl.h \
$(top_srcdir)/include/sys/spa_checksum.h \
+ $(top_srcdir)/include/sys/sysevent.h \
$(top_srcdir)/include/sys/trace.h \
$(top_srcdir)/include/sys/trace_acl.h \
$(top_srcdir)/include/sys/trace_arc.h \
#define FM_EREPORT_ZFS_IO "io"
#define FM_EREPORT_ZFS_DATA "data"
#define FM_EREPORT_ZFS_DELAY "delay"
-#define FM_EREPORT_ZFS_CONFIG_SYNC "config.sync"
#define FM_EREPORT_ZFS_POOL "zpool"
-#define FM_EREPORT_ZFS_POOL_DESTROY "zpool.destroy"
-#define FM_EREPORT_ZFS_POOL_REGUID "zpool.reguid"
#define FM_EREPORT_ZFS_DEVICE_UNKNOWN "vdev.unknown"
#define FM_EREPORT_ZFS_DEVICE_OPEN_FAILED "vdev.open_failed"
#define FM_EREPORT_ZFS_DEVICE_CORRUPT_DATA "vdev.corrupt_data"
#define FM_EREPORT_ZFS_DEVICE_TOO_SMALL "vdev.too_small"
#define FM_EREPORT_ZFS_DEVICE_BAD_LABEL "vdev.bad_label"
#define FM_EREPORT_ZFS_DEVICE_BAD_ASHIFT "vdev.bad_ashift"
-#define FM_EREPORT_ZFS_DEVICE_REMOVE "vdev.remove"
-#define FM_EREPORT_ZFS_DEVICE_CLEAR "vdev.clear"
-#define FM_EREPORT_ZFS_DEVICE_CHECK "vdev.check"
-#define FM_EREPORT_ZFS_DEVICE_SPARE "vdev.spare"
-#define FM_EREPORT_ZFS_DEVICE_AUTOEXPAND "vdev.autoexpand"
#define FM_EREPORT_ZFS_IO_FAILURE "io_failure"
#define FM_EREPORT_ZFS_PROBE_FAILURE "probe_failure"
#define FM_EREPORT_ZFS_LOG_REPLAY "log_replay"
#define FM_EREPORT_ZFS_CONFIG_CACHE_WRITE "config_cache_write"
-#define FM_EREPORT_ZFS_RESILVER_START "resilver.start"
-#define FM_EREPORT_ZFS_RESILVER_FINISH "resilver.finish"
-#define FM_EREPORT_ZFS_SCRUB_START "scrub.start"
-#define FM_EREPORT_ZFS_SCRUB_FINISH "scrub.finish"
-#define FM_EREPORT_ZFS_BOOTFS_VDEV_ATTACH "bootfs.vdev.attach"
#define FM_EREPORT_PAYLOAD_ZFS_POOL "pool"
#define FM_EREPORT_PAYLOAD_ZFS_POOL_FAILMODE "pool_failmode"
#define FM_EREPORT_FAILMODE_CONTINUE "continue"
#define FM_EREPORT_FAILMODE_PANIC "panic"
-#define FM_EREPORT_RESOURCE_REMOVED "removed"
-#define FM_EREPORT_RESOURCE_AUTOREPLACE "autoreplace"
-#define FM_EREPORT_RESOURCE_STATECHANGE "statechange"
+#define FM_RESOURCE_REMOVED "removed"
+#define FM_RESOURCE_AUTOREPLACE "autoreplace"
+#define FM_RESOURCE_STATECHANGE "statechange"
#ifdef __cplusplus
}
#define FM_RSRC_CLASS "resource"
#define FM_LIST_EVENT "list"
#define FM_IREPORT_CLASS "ireport"
+#define FM_SYSEVENT_CLASS "sysevent"
/* FM list.* event class values */
#define FM_LIST_SUSPECT_CLASS FM_LIST_EVENT ".suspect"
extern void zfs_post_remove(spa_t *spa, vdev_t *vd);
extern void zfs_post_state_change(spa_t *spa, vdev_t *vd);
extern void zfs_post_autoreplace(spa_t *spa, vdev_t *vd);
+extern void zfs_post_sysevent(spa_t *spa, vdev_t *vd, const char *name);
extern uint64_t spa_get_errlog_size(spa_t *spa);
extern int spa_get_errlog(spa_t *spa, void *uaddr, size_t *count);
extern void spa_errlog_rotate(spa_t *spa);
* Use is subject to license terms.
*/
-#ifndef _LIBSPL_SYS_SYSEVENT_H
-#define _LIBSPL_SYS_SYSEVENT_H
+#ifndef _SYS_SYSEVENT_H
+#define _SYS_SYSEVENT_H
#endif
--- /dev/null
+COMMON_H = \
+ $(top_srcdir)/include/sys/sysevent/eventdefs.h
+
+KERNEL_H =
+
+USER_H =
+
+EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+
+if CONFIG_USER
+libzfsdir = $(includedir)/libzfs/sys/sysevent
+libzfs_HEADERS = $(COMMON_H) $(USER_H)
+endif
+
+if CONFIG_KERNEL
+kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys/sysevent
+kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+endif
--- /dev/null
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ */
+
+#ifndef _SYS_SYSEVENT_EVENTDEFS_H
+#define _SYS_SYSEVENT_EVENTDEFS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * eventdefs.h contains public definitions for sysevent types (classes
+ * and subclasses). All additions/removal/changes are subject
+ * to PSARC approval.
+ */
+
+/* Sysevent Class definitions */
+#define EC_NONE "EC_none"
+#define EC_PRIV "EC_priv"
+#define EC_PLATFORM "EC_platform" /* events private to platform */
+#define EC_DR "EC_dr" /* Dynamic reconfiguration event class */
+#define EC_ENV "EC_env" /* Environmental monitor event class */
+#define EC_DOMAIN "EC_domain" /* Domain event class */
+#define EC_AP_DRIVER "EC_ap_driver" /* Alternate Pathing event class */
+#define EC_IPMP "EC_ipmp" /* IP Multipathing event class */
+#define EC_DEV_ADD "EC_dev_add" /* device add event class */
+#define EC_DEV_REMOVE "EC_dev_remove" /* device remove event class */
+#define EC_DEV_BRANCH "EC_dev_branch" /* device tree branch event class */
+#define EC_DEV_STATUS "EC_dev_status" /* device status event class */
+#define EC_FM "EC_fm" /* FMA error report event */
+#define EC_ZFS "EC_zfs" /* ZFS event */
+#define EC_DATALINK "EC_datalink" /* datalink event */
+#define EC_VRRP "EC_vrrp" /* VRRP event */
+
+/*
+ * EC_DEV_ADD and EC_DEV_REMOVE subclass definitions - supporting attributes
+ * (name/value pairs) are found in sys/sysevent/dev.h
+ */
+#define ESC_DISK "disk" /* disk device */
+#define ESC_NETWORK "network" /* network interface */
+#define ESC_PRINTER "printer" /* printer device */
+#define ESC_LOFI "lofi" /* lofi device */
+
+/*
+ * EC_DEV_BRANCH subclass definitions - supporting attributes (name/value pairs)
+ * are found in sys/sysevent/dev.h
+ */
+
+/* device tree branch added */
+#define ESC_DEV_BRANCH_ADD "dev_branch_add"
+
+/* device tree branch removed */
+#define ESC_DEV_BRANCH_REMOVE "dev_branch_remove"
+
+/*
+ * EC_DEV_STATUS subclass definitions
+ *
+ * device capacity dynamically changed
+ */
+#define ESC_DEV_DLE "dev_dle"
+
+/* LUN has received an eject request from the user */
+#define ESC_DEV_EJECT_REQUEST "dev_eject_request"
+
+/* FMA Fault and Error event protocol subclass */
+#define ESC_FM_ERROR "error"
+#define ESC_FM_ERROR_REPLAY "error_replay"
+
+/*
+ * ZFS subclass definitions. supporting attributes (name/value paris) are found
+ * in sys/fs/zfs.h
+ */
+#define ESC_ZFS_RESILVER_START "resilver_start"
+#define ESC_ZFS_RESILVER_FINISH "resilver_finish"
+#define ESC_ZFS_VDEV_REMOVE "vdev_remove"
+#define ESC_ZFS_VDEV_REMOVE_AUX "vdev_remove_aux"
+#define ESC_ZFS_VDEV_REMOVE_DEV "vdev_remove_dev"
+#define ESC_ZFS_POOL_CREATE "pool_create"
+#define ESC_ZFS_POOL_DESTROY "pool_destroy"
+#define ESC_ZFS_POOL_IMPORT "pool_import"
+#define ESC_ZFS_VDEV_ADD "vdev_add"
+#define ESC_ZFS_VDEV_ATTACH "vdev_attach"
+#define ESC_ZFS_VDEV_CLEAR "vdev_clear"
+#define ESC_ZFS_VDEV_CHECK "vdev_check"
+#define ESC_ZFS_VDEV_ONLINE "vdev_online"
+#define ESC_ZFS_CONFIG_SYNC "config_sync"
+#define ESC_ZFS_SCRUB_START "scrub_start"
+#define ESC_ZFS_SCRUB_FINISH "scrub_finish"
+#define ESC_ZFS_VDEV_SPARE "vdev_spare"
+#define ESC_ZFS_VDEV_AUTOEXPAND "vdev_autoexpand"
+#define ESC_ZFS_BOOTFS_VDEV_ATTACH "bootfs_vdev_attach"
+#define ESC_ZFS_POOL_REGUID "pool_reguid"
+
+/*
+ * datalink subclass definitions.
+ */
+#define ESC_DATALINK_PHYS_ADD "datalink_phys_add" /* new physical link */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_SYSEVENT_EVENTDEFS_H */
#include <sys/sdt.h>
#include <sys/kstat.h>
#include <sys/zfs_debug.h>
+#include <sys/sysevent.h>
+#include <sys/sysevent/eventdefs.h>
#include <sys/zfs_delay.h>
-#include <sys/fm/fs/zfs.h>
#include <sys/sunddi.h>
#include <sys/ctype.h>
#include <sys/disp.h>
#include <sys/sdt.h>
#include <sys/kstat.h>
#include <sys/u8_textprep.h>
-#include <sys/fm/fs/zfs.h>
+#include <sys/sysevent.h>
+#include <sys/sysevent/eventdefs.h>
#include <sys/sunddi.h>
#include <sys/debug.h>
#include <sys/utsname.h>
-SUBDIRS = dktp sysevent
+SUBDIRS = dktp
libspldir = $(includedir)/libspl/sys
libspl_HEADERS = \
$(top_srcdir)/lib/libspl/include/sys/stat.h \
$(top_srcdir)/lib/libspl/include/sys/stropts.h \
$(top_srcdir)/lib/libspl/include/sys/sunddi.h \
- $(top_srcdir)/lib/libspl/include/sys/sysevent.h \
$(top_srcdir)/lib/libspl/include/sys/sysmacros.h \
$(top_srcdir)/lib/libspl/include/sys/systeminfo.h \
$(top_srcdir)/lib/libspl/include/sys/systm.h \
+++ /dev/null
-libspldir = $(includedir)/libspl/sys/sysevent
-libspl_HEADERS = \
- $(top_srcdir)/lib/libspl/include/sys/sysevent/eventdefs.h
+++ /dev/null
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
- */
-
-#ifndef _SYS_SYSEVENT_EVENTDEFS_H
-#define _SYS_SYSEVENT_EVENTDEFS_H
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * eventdefs.h contains public definitions for sysevent types (classes
- * and subclasses). All additions/removal/changes are subject
- * to PSARC approval.
- */
-
-/* Sysevent Class definitions */
-#define EC_NONE "EC_none"
-#define EC_PRIV "EC_priv"
-#define EC_PLATFORM "EC_platform" /* events private to platform */
-#define EC_DR "EC_dr" /* Dynamic reconfiguration event class */
-#define EC_ENV "EC_env" /* Environmental monitor event class */
-#define EC_DOMAIN "EC_domain" /* Domain event class */
-#define EC_AP_DRIVER "EC_ap_driver" /* Alternate Pathing event class */
-#define EC_IPMP "EC_ipmp" /* IP Multipathing event class */
-#define EC_DEV_ADD "EC_dev_add" /* device add event class */
-#define EC_DEV_REMOVE "EC_dev_remove" /* device remove event class */
-#define EC_DEV_BRANCH "EC_dev_branch" /* device tree branch event class */
-#define EC_FM "EC_fm" /* FMA error report event */
-#define EC_ZFS "EC_zfs" /* ZFS event */
-
-/*
- * The following event class is reserved for exclusive use
- * by Sun Cluster software.
- */
-#define EC_CLUSTER "EC_Cluster"
-
-/*
- * The following classes are exclusively reserved for use by the
- * Solaris Volume Manager (SVM)
- */
-#define EC_SVM_CONFIG "EC_SVM_Config"
-#define EC_SVM_STATE "EC_SVM_State"
-
-/*
- * EC_SVM_CONFIG subclass definitions - supporting attributes (name/value pairs)
- * are found in sys/sysevent/svm.h
- */
-#define ESC_SVM_CREATE "ESC_SVM_Create"
-#define ESC_SVM_DELETE "ESC_SVM_Delete"
-#define ESC_SVM_ADD "ESC_SVM_Add"
-#define ESC_SVM_REMOVE "ESC_SVM_Remove"
-#define ESC_SVM_REPLACE "ESC_SVM_Replace"
-#define ESC_SVM_GROW "ESC_SVM_Grow"
-#define ESC_SVM_RENAME_SRC "ESC_SVM_Rename_Src"
-#define ESC_SVM_RENAME_DST "ESC_SVM_Rename_Dst"
-#define ESC_SVM_MEDIATOR_ADD "ESC_SVM_Mediator_Add"
-#define ESC_SVM_MEDIATOR_DELETE "ESC_SVM_Mediator_Delete"
-#define ESC_SVM_HOST_ADD "ESC_SVM_Host_Add"
-#define ESC_SVM_HOST_DELETE "ESC_SVM_Host_Delete"
-#define ESC_SVM_DRIVE_ADD "ESC_SVM_Drive_Add"
-#define ESC_SVM_DRIVE_DELETE "ESC_SVM_Drive_Delete"
-#define ESC_SVM_DETACH "ESC_SVM_Detach"
-#define ESC_SVM_DETACHING "ESC_SVM_Detaching"
-#define ESC_SVM_ATTACH "ESC_SVM_Attach"
-#define ESC_SVM_ATTACHING "ESC_SVM_Attaching"
-
-/*
- * EC_SVM_STATE subclass definitions - supporting attributes (name/value pairs)
- * are found in sys/sysevent/svm.h
- */
-#define ESC_SVM_INIT_START "ESC_SVM_Init_Start"
-#define ESC_SVM_INIT_FAILED "ESC_SVM_Init_Failed"
-#define ESC_SVM_INIT_FATAL "ESC_SVM_Init_Fatal"
-#define ESC_SVM_INIT_SUCCESS "ESC_SVM_Init_Success"
-#define ESC_SVM_IOERR "ESC_SVM_Ioerr"
-#define ESC_SVM_ERRED "ESC_SVM_Erred"
-#define ESC_SVM_LASTERRED "ESC_SVM_Lasterred"
-#define ESC_SVM_OK "ESC_SVM_Ok"
-#define ESC_SVM_ENABLE "ESC_SVM_Enable"
-#define ESC_SVM_RESYNC_START "ESC_SVM_Resync_Start"
-#define ESC_SVM_RESYNC_FAILED "ESC_SVM_Resync_Failed"
-#define ESC_SVM_RESYNC_SUCCESS "ESC_SVM_Resync_Success"
-#define ESC_SVM_RESYNC_DONE "ESC_SVM_Resync_Done"
-#define ESC_SVM_HOTSPARED "ESC_SVM_Hotspared"
-#define ESC_SVM_HS_FREED "ESC_SVM_HS_Freed"
-#define ESC_SVM_HS_CHANGED "ESC_SVM_HS_Changed"
-#define ESC_SVM_TAKEOVER "ESC_SVM_Takeover"
-#define ESC_SVM_RELEASE "ESC_SVM_Release"
-#define ESC_SVM_OPEN_FAIL "ESC_SVM_Open_Fail"
-#define ESC_SVM_OFFLINE "ESC_SVM_Offline"
-#define ESC_SVM_ONLINE "ESC_SVM_Online"
-#define ESC_SVM_CHANGE "ESC_SVM_Change"
-#define ESC_SVM_EXCHANGE "ESC_SVM_Exchange"
-#define ESC_SVM_REGEN_START "ESC_SVM_Regen_Start"
-#define ESC_SVM_REGEN_DONE "ESC_SVM_Regen_Done"
-#define ESC_SVM_REGEN_FAILED "ESC_SVM_Regen_Failed"
-
-/*
- * EC_DR subclass definitions - supporting attributes (name/value pairs)
- * are found in sys/sysevent/dr.h
- */
-
-/* Attachment point state change */
-#define ESC_DR_AP_STATE_CHANGE "ESC_dr_ap_state_change"
-#define ESC_DR_REQ "ESC_dr_req" /* Request DR */
-#define ESC_DR_TARGET_STATE_CHANGE "ESC_dr_target_state_change"
-
-/*
- * EC_ENV subclass definitions - supporting attributes (name/value pairs)
- * are found in sys/sysevent/env.h
- */
-#define ESC_ENV_TEMP "ESC_env_temp" /* Temperature change event subclass */
-#define ESC_ENV_FAN "ESC_env_fan" /* Fan status change event subclass */
-#define ESC_ENV_POWER "ESC_env_power" /* Power supply change event subclass */
-#define ESC_ENV_LED "ESC_env_led" /* LED change event subclass */
-
-/*
- * EC_DOMAIN subclass definitions - supporting attributes (name/value pairs)
- * are found in sys/sysevent/domain.h
- */
-
-/* Domain state change */
-#define ESC_DOMAIN_STATE_CHANGE "ESC_domain_state_change"
-/* Domain loghost name change */
-#define ESC_DOMAIN_LOGHOST_CHANGE "ESC_domain_loghost_change"
-
-/*
- * EC_AP_DRIVER subclass definitions - supporting attributes (name/value pairs)
- * are found in sys/sysevent/ap_driver.h
- */
-
-/* Alternate Pathing path switch */
-#define ESC_AP_DRIVER_PATHSWITCH "ESC_ap_driver_pathswitch"
-/* Alternate Pathing database commit */
-#define ESC_AP_DRIVER_COMMIT "ESC_ap_driver_commit"
-/* Alternate Pathing physical path status change */
-#define ESC_AP_DRIVER_PHYS_PATH_STATUS_CHANGE \
- "ESC_ap_driver_phys_path_status_change"
-
-/*
- * EC_IPMP subclass definitions - supporting attributes (name/value pairs)
- * are found in sys/sysevent/ipmp.h
- */
-
-/* IPMP group has changed state */
-#define ESC_IPMP_GROUP_STATE "ESC_ipmp_group_state"
-
-/* IPMP group has been created or removed */
-#define ESC_IPMP_GROUP_CHANGE "ESC_ipmp_group_change"
-
-/* IPMP group has had an interface added or removed */
-#define ESC_IPMP_GROUP_MEMBER_CHANGE "ESC_ipmp_group_member_change"
-
-/* Interface within an IPMP group has changed state or type */
-#define ESC_IPMP_IF_CHANGE "ESC_ipmp_if_change"
-
-
-/*
- * EC_DEV_ADD and EC_DEV_REMOVE subclass definitions - supporting attributes
- * (name/value pairs) are found in sys/sysevent/dev.h
- */
-#define ESC_DISK "disk" /* disk device */
-#define ESC_NETWORK "network" /* network interface */
-#define ESC_PRINTER "printer" /* printer device */
-#define ESC_LOFI "lofi" /* lofi device */
-
-/*
- * EC_DEV_BRANCH subclass definitions - supporting attributes (name/value pairs)
- * are found in sys/sysevent/dev.h
- */
-
-/* device tree branch added */
-#define ESC_DEV_BRANCH_ADD "ESC_dev_branch_add"
-
-/* device tree branch removed */
-#define ESC_DEV_BRANCH_REMOVE "ESC_dev_branch_remove"
-
-/* FMA Fault and Error event protocol subclass */
-#define ESC_FM_ERROR "ESC_FM_error"
-#define ESC_FM_ERROR_REPLAY "ESC_FM_error_replay"
-
-/* Service processor subclass definitions */
-#define ESC_PLATFORM_SP_RESET "ESC_platform_sp_reset"
-
-/*
- * EC_ACPIEV subclass definitions
- */
-#define EC_ACPIEV "EC_acpiev"
-#define ESC_ACPIEV_ADD "ESC_acpiev_add"
-#define ESC_ACPIEV_REMOVE "ESC_acpiev_remove"
-#define ESC_ACPIEV_WARN "ESC_acpiev_warn"
-#define ESC_ACPIEV_LOW "ESC_acpiev_low"
-#define ESC_ACPIEV_STATE_CHANGE "ESC_acpiev_state_change"
-
-/*
- * ZFS subclass definitions. supporting attributes (name/value paris) are found
- * in sys/fs/zfs.h
- */
-#define ESC_ZFS_RESILVER_START "ESC_ZFS_resilver_start"
-#define ESC_ZFS_RESILVER_FINISH "ESC_ZFS_resilver_finish"
-#define ESC_ZFS_VDEV_REMOVE "ESC_ZFS_vdev_remove"
-#define ESC_ZFS_POOL_DESTROY "ESC_ZFS_pool_destroy"
-#define ESC_ZFS_VDEV_CLEAR "ESC_ZFS_vdev_clear"
-#define ESC_ZFS_VDEV_CHECK "ESC_ZFS_vdev_check"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _SYS_SYSEVENT_EVENTDEFS_H */
if (vdev_resilver_needed(spa->spa_root_vdev,
&scn->scn_phys.scn_min_txg, &scn->scn_phys.scn_max_txg)) {
- spa_event_notify(spa, NULL,
- FM_EREPORT_ZFS_RESILVER_START);
+ spa_event_notify(spa, NULL, ESC_ZFS_RESILVER_START);
} else {
- spa_event_notify(spa, NULL,
- FM_EREPORT_ZFS_SCRUB_START);
+ spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_START);
}
spa->spa_scrub_started = B_TRUE;
complete ? scn->scn_phys.scn_max_txg : 0, B_TRUE);
if (complete) {
spa_event_notify(spa, NULL, scn->scn_phys.scn_min_txg ?
- FM_EREPORT_ZFS_RESILVER_FINISH :
- FM_EREPORT_ZFS_SCRUB_FINISH);
+ ESC_ZFS_RESILVER_FINISH : ESC_ZFS_SCRUB_FINISH);
}
spa_errlog_rotate(spa);
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2015, Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2013, 2014, Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
* Copyright (c) 2016 Actifio, Inc. All rights reserved.
if (error == 0) {
spa_config_sync(spa, B_FALSE, B_TRUE);
- spa_event_notify(spa, NULL, FM_EREPORT_ZFS_POOL_REGUID);
+ spa_event_notify(spa, NULL, ESC_ZFS_POOL_REGUID);
}
mutex_exit(&spa_namespace_lock);
if (vd->vdev_ops->vdev_op_leaf && vdev_is_dead(vd) &&
!vd->vdev_ishole) {
- zfs_ereport_post(FM_EREPORT_RESOURCE_AUTOREPLACE,
- vd->vdev_spa, vd, NULL, 0, 0);
- spa_event_notify(vd->vdev_spa, vd, FM_EREPORT_ZFS_DEVICE_CHECK);
+ zfs_post_autoreplace(vd->vdev_spa, vd);
+ spa_event_notify(vd->vdev_spa, vd, ESC_ZFS_VDEV_CHECK);
}
}
txg_wait_synced(spa->spa_dsl_pool, txg);
spa_config_sync(spa, B_FALSE, B_TRUE);
+ spa_event_notify(spa, NULL, ESC_ZFS_POOL_CREATE);
spa_history_log_version(spa, "create");
spa_configfile_set(spa, props, B_FALSE);
spa_config_sync(spa, B_FALSE, B_TRUE);
+ spa_event_notify(spa, NULL, ESC_ZFS_POOL_IMPORT);
mutex_exit(&spa_namespace_lock);
return (0);
*/
spa_async_request(spa, SPA_ASYNC_AUTOEXPAND);
- mutex_exit(&spa_namespace_lock);
spa_history_log_version(spa, "import");
+
+ spa_event_notify(spa, NULL, ESC_ZFS_POOL_IMPORT);
+
zvol_create_minors(spa, pool, B_TRUE);
+ mutex_exit(&spa_namespace_lock);
+
return (0);
}
}
export_spa:
- spa_event_notify(spa, NULL, FM_EREPORT_ZFS_POOL_DESTROY);
+ spa_event_notify(spa, NULL, ESC_ZFS_POOL_DESTROY);
if (spa->spa_state != POOL_STATE_UNINITIALIZED) {
spa_unload(spa);
mutex_enter(&spa_namespace_lock);
spa_config_update(spa, SPA_CONFIG_UPDATE_POOL);
+ spa_event_notify(spa, NULL, ESC_ZFS_VDEV_ADD);
mutex_exit(&spa_namespace_lock);
return (0);
if (newvd->vdev_isspare) {
spa_spare_activate(newvd);
- spa_event_notify(spa, newvd, FM_EREPORT_ZFS_DEVICE_SPARE);
+ spa_event_notify(spa, newvd, ESC_ZFS_VDEV_SPARE);
}
oldvdpath = spa_strdup(oldvd->vdev_path);
*/
dsl_resilver_restart(spa->spa_dsl_pool, dtl_max_txg);
+ if (spa->spa_bootfs)
+ spa_event_notify(spa, newvd, ESC_ZFS_BOOTFS_VDEV_ATTACH);
+
+ spa_event_notify(spa, newvd, ESC_ZFS_VDEV_ATTACH);
+
/*
* Commit the config
*/
spa_strfree(oldvdpath);
spa_strfree(newvdpath);
- if (spa->spa_bootfs)
- spa_event_notify(spa, newvd, FM_EREPORT_ZFS_BOOTFS_VDEV_ATTACH);
-
return (0);
}
vd->vdev_detached = B_TRUE;
vdev_dirty(tvd, VDD_DTL, vd, txg);
- spa_event_notify(spa, vd, FM_EREPORT_ZFS_DEVICE_REMOVE);
+ spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE);
/* hang on to the spa before we release the lock */
spa_open_ref(spa, FTAG);
} else {
error = SET_ERROR(EBUSY);
}
+ spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
} else if (spa->spa_l2cache.sav_vdevs != NULL &&
nvlist_lookup_nvlist_array(spa->spa_l2cache.sav_config,
ZPOOL_CONFIG_L2CACHE, &l2cache, &nl2cache) == 0 &&
ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv);
spa_load_l2cache(spa);
spa->spa_l2cache.sav_sync = B_TRUE;
+ spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
} else if (vd != NULL && vd->vdev_islog) {
ASSERT(!locked);
ASSERT(vd == vd->vdev_top);
*/
spa_vdev_remove_from_namespace(spa, vd);
+ spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV);
} else if (vd != NULL) {
/*
* Normal vdevs cannot be removed (yet).
if (!vd->vdev_ops->vdev_op_leaf || vd->vdev_physpath == NULL)
return;
- spa_event_notify(vd->vdev_spa, vd, FM_EREPORT_ZFS_DEVICE_AUTOEXPAND);
+ spa_event_notify(vd->vdev_spa, vd, ESC_ZFS_VDEV_AUTOEXPAND);
}
static void
}
/*
- * Post a FM_EREPORT_ZFS_* event from sys/fm/fs/zfs.h. The payload will be
+ * Post a zevent corresponding to the given sysevent. The 'name' must be one
+ * of the event definitions in sys/sysevent/eventdefs.h. The payload will be
* filled in from the spa and (optionally) the vdev. This doesn't do anything
* in the userland libzpool, as we don't want consumers to misinterpret ztest
* or zdb as real changes.
void
spa_event_notify(spa_t *spa, vdev_t *vd, const char *name)
{
-#ifdef _KERNEL
- zfs_ereport_post(name, spa, vd, NULL, 0, 0);
-#endif
+ zfs_post_sysevent(spa, vd, name);
}
#if defined(_KERNEL) && defined(HAVE_SPL)
spa_config_generation++;
if (postsysevent)
- spa_event_notify(target, NULL, FM_EREPORT_ZFS_CONFIG_SYNC);
+ spa_event_notify(target, NULL, ESC_ZFS_CONFIG_SYNC);
}
/*
vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, vdev_state_t *newstate)
{
vdev_t *vd, *tvd, *pvd, *rvd = spa->spa_root_vdev;
+ boolean_t postevent = B_FALSE;
spa_vdev_state_enter(spa, SCL_NONE);
if (!vd->vdev_ops->vdev_op_leaf)
return (spa_vdev_state_exit(spa, NULL, ENOTSUP));
+ postevent =
+ (vd->vdev_offline == B_TRUE || vd->vdev_tmpoffline == B_TRUE) ?
+ B_TRUE : B_FALSE;
+
tvd = vd->vdev_top;
vd->vdev_offline = B_FALSE;
vd->vdev_tmpoffline = B_FALSE;
return (spa_vdev_state_exit(spa, vd, ENOTSUP));
spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE);
}
+
+ if (postevent)
+ spa_event_notify(spa, vd, ESC_ZFS_VDEV_ONLINE);
+
return (spa_vdev_state_exit(spa, vd, 0));
}
if (vd->vdev_aux == NULL && !vdev_is_dead(vd))
spa_async_request(spa, SPA_ASYNC_RESILVER);
- spa_event_notify(spa, vd, FM_EREPORT_ZFS_DEVICE_CLEAR);
+ spa_event_notify(spa, vd, ESC_ZFS_VDEV_CLEAR);
}
/*
}
static void
-zfs_post_common(spa_t *spa, vdev_t *vd, const char *name)
+zfs_post_common(spa_t *spa, vdev_t *vd, const char *type, const char *name)
{
#ifdef _KERNEL
nvlist_t *resource;
if ((resource = fm_nvlist_create(NULL)) == NULL)
return;
- (void) snprintf(class, sizeof (class), "%s.%s.%s", FM_RSRC_RESOURCE,
+ (void) snprintf(class, sizeof (class), "%s.%s.%s", type,
ZFS_ERROR_CLASS, name);
VERIFY0(nvlist_add_uint8(resource, FM_VERSION, FM_RSRC_VERSION));
VERIFY0(nvlist_add_string(resource, FM_CLASS, class));
FM_EREPORT_PAYLOAD_ZFS_VDEV_GUID, vd->vdev_guid));
VERIFY0(nvlist_add_uint64(resource,
FM_EREPORT_PAYLOAD_ZFS_VDEV_STATE, vd->vdev_state));
+ if (vd->vdev_path != NULL)
+ VERIFY0(nvlist_add_string(resource,
+ FM_EREPORT_PAYLOAD_ZFS_VDEV_PATH, vd->vdev_path));
+ if (vd->vdev_devid != NULL)
+ VERIFY0(nvlist_add_string(resource,
+ FM_EREPORT_PAYLOAD_ZFS_VDEV_DEVID, vd->vdev_devid));
+ if (vd->vdev_fru != NULL)
+ VERIFY0(nvlist_add_string(resource,
+ FM_EREPORT_PAYLOAD_ZFS_VDEV_FRU, vd->vdev_fru));
}
zfs_zevent_post(resource, NULL, zfs_zevent_post_cb);
void
zfs_post_remove(spa_t *spa, vdev_t *vd)
{
- zfs_post_common(spa, vd, FM_EREPORT_RESOURCE_REMOVED);
+ zfs_post_common(spa, vd, FM_RSRC_CLASS, FM_RESOURCE_REMOVED);
}
/*
void
zfs_post_autoreplace(spa_t *spa, vdev_t *vd)
{
- zfs_post_common(spa, vd, FM_EREPORT_RESOURCE_AUTOREPLACE);
+ zfs_post_common(spa, vd, FM_RSRC_CLASS, FM_RESOURCE_AUTOREPLACE);
}
/*
void
zfs_post_state_change(spa_t *spa, vdev_t *vd)
{
- zfs_post_common(spa, vd, FM_EREPORT_RESOURCE_STATECHANGE);
+ zfs_post_common(spa, vd, FM_RSRC_CLASS, FM_RESOURCE_STATECHANGE);
+}
+
+/*
+ * The 'sysevent.fs.zfs.*' events are signals posted to notify user space of
+ * change in the pool. All sysevents are listed in sys/sysevent/eventdefs.h
+ * and are designed to be consumed by the ZFS Event Daemon (ZED). For
+ * additional details refer to the zed(8) man page.
+ */
+void
+zfs_post_sysevent(spa_t *spa, vdev_t *vd, const char *name)
+{
+ zfs_post_common(spa, vd, FM_SYSEVENT_CLASS, name);
}
#if defined(_KERNEL) && defined(HAVE_SPL)
EXPORT_SYMBOL(zfs_post_remove);
EXPORT_SYMBOL(zfs_post_autoreplace);
EXPORT_SYMBOL(zfs_post_state_change);
+EXPORT_SYMBOL(zfs_post_sysevent);
#endif /* _KERNEL */