Navigation Menu

Skip to content

Commit

Permalink
OpenZFS 5997 - FRU field not set during pool creation and never updated
Browse files Browse the repository at this point in the history
Authored by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Reviewed by: Richard Elling <richard.elling@gmail.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Signed-off-by: Don Brady <don.brady@intel.com>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>

OpenZFS-issue: https://www.illumos.org/issues/5997
OpenZFS-commit: openzfs/openzfs@1437283

Porting Notes:

In addition to the OpenZFS changes this patch realigns the events
with those found in OpenZFS.

Events which would be logged as sysevents on illumos have been
been mapped to the 'sysevent' class for Linux.  In addition, several
subclass names have been changed to match what is used in OpenZFS.
In all cases this means a '.' was changed to an '_' in the subclass.

The scripts provided by ZoL have been updated, however users which
provide scripts for any of the following events will need to rename
them based on the new subclass names.

  ereport.fs.zfs.config.sync         sysevent.fs.zfs.config_sync
  ereport.fs.zfs.zpool.destroy       sysevent.fs.zfs.pool_destroy
  ereport.fs.zfs.zpool.reguid        sysevent.fs.zfs.pool_reguid
  ereport.fs.zfs.vdev.remove         sysevent.fs.zfs.vdev_remove
  ereport.fs.zfs.vdev.clear          sysevent.fs.zfs.vdev_clear
  ereport.fs.zfs.vdev.check          sysevent.fs.zfs.vdev_check
  ereport.fs.zfs.vdev.spare          sysevent.fs.zfs.vdev_spare
  ereport.fs.zfs.vdev.autoexpand     sysevent.fs.zfs.vdev_autoexpand
  ereport.fs.zfs.resilver.start      sysevent.fs.zfs.resilver_start
  ereport.fs.zfs.resilver.finish     sysevent.fs.zfs.resilver_finish
  ereport.fs.zfs.scrub.start         sysevent.fs.zfs.scrub_start
  ereport.fs.zfs.scrub.finish        sysevent.fs.zfs.scrub_finish
  ereport.fs.zfs.bootfs.vdev.attach  sysevent.fs.zfs.bootfs_vdev_attach
  • Loading branch information
Hans Rosenfeld authored and behlendorf committed Aug 12, 2016
1 parent 834f1e4 commit fb390aa
Show file tree
Hide file tree
Showing 22 changed files with 238 additions and 305 deletions.
8 changes: 4 additions & 4 deletions cmd/zed/Makefile.am
Expand Up @@ -49,8 +49,8 @@ dist_zedexec_SCRIPTS = \
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 \
Expand All @@ -59,8 +59,8 @@ zedconfdefaults = \
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)"
Expand Down
1 change: 0 additions & 1 deletion cmd/zed/zed.d/resilver.finish-notify.sh

This file was deleted.

1 change: 1 addition & 0 deletions cmd/zed/zed.d/resilver_finish-notify.sh
@@ -1,8 +1,8 @@
#!/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.
#
Expand All @@ -19,9 +19,9 @@
[ -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}\""
Expand All @@ -33,7 +33,7 @@ zed_check_cmd "${ZPOOL}" || exit 9
# 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
Expand Down
5 changes: 2 additions & 3 deletions cmd/zed/zed_event.c
Expand Up @@ -748,9 +748,8 @@ _zed_event_add_env_preserve(uint64_t eid, zed_strings_t *zsp)

/*
* 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)
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -80,7 +80,6 @@ AC_CONFIG_FILES([
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
Expand Down Expand Up @@ -134,6 +133,7 @@ AC_CONFIG_FILES([
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
Expand Down
3 changes: 2 additions & 1 deletion include/sys/Makefile.am
@@ -1,4 +1,4 @@
SUBDIRS = fm fs crypto
SUBDIRS = fm fs crypto sysevent

COMMON_H = \
$(top_srcdir)/include/sys/arc.h \
Expand Down Expand Up @@ -52,6 +52,7 @@ COMMON_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 \
Expand Down
19 changes: 3 additions & 16 deletions include/sys/fm/fs/zfs.h
Expand Up @@ -36,10 +36,7 @@ extern "C" {
#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"
Expand All @@ -48,20 +45,10 @@ extern "C" {
#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"
Expand Down Expand Up @@ -116,9 +103,9 @@ extern "C" {
#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
}
Expand Down
1 change: 1 addition & 0 deletions include/sys/fm/protocol.h
Expand Up @@ -50,6 +50,7 @@ extern "C" {
#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"
Expand Down
1 change: 1 addition & 0 deletions include/sys/spa.h
Expand Up @@ -851,6 +851,7 @@ extern void zfs_ereport_post(const char *class, spa_t *spa, vdev_t *vd,
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);
Expand Down
4 changes: 2 additions & 2 deletions lib/libspl/include/sys/sysevent.h → include/sys/sysevent.h
Expand Up @@ -24,7 +24,7 @@
* 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
18 changes: 18 additions & 0 deletions include/sys/sysevent/Makefile.am
@@ -0,0 +1,18 @@
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
125 changes: 125 additions & 0 deletions include/sys/sysevent/eventdefs.h
@@ -0,0 +1,125 @@
/*
* 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 */
6 changes: 4 additions & 2 deletions include/sys/zfs_context.h
Expand Up @@ -64,8 +64,9 @@
#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>
Expand Down Expand Up @@ -119,7 +120,8 @@
#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>
Expand Down
3 changes: 1 addition & 2 deletions lib/libspl/include/sys/Makefile.am
@@ -1,4 +1,4 @@
SUBDIRS = dktp sysevent
SUBDIRS = dktp

libspldir = $(includedir)/libspl/sys
libspl_HEADERS = \
Expand Down Expand Up @@ -37,7 +37,6 @@ 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 \
Expand Down
3 changes: 0 additions & 3 deletions lib/libspl/include/sys/sysevent/Makefile.am

This file was deleted.

0 comments on commit fb390aa

Please sign in to comment.