mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
OpenZFS 6939 - add sysevents to zfs core for commands
Authored by: Dave Eddy <dave@daveeddy.com> Reviewed by: Patrick Mooney <patrick.mooney@joyent.com> Reviewed by: Joshua M. Clulow <jmc@joyent.com> Reviewed by: Josh Wilsdon <jwilsdon@joyent.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Richard Elling <Richard.Elling@RichardElling.com> Reviewed by: Alan Somers <asomers@gmail.com> Reviewed by: Andrew Stormont <andyjstormont@gmail.com> Approved by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: George Melikov <mail@gmelikov.ru> Ported-by: Giuseppe Di Natale <dinatale2@llnl.gov> OpenZFS-issue: https://www.illumos.org/issues/6939 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/ce1577b Closes #6328
This commit is contained in:
committed by
Brian Behlendorf
parent
314be68aa9
commit
12fa0466df
@@ -93,6 +93,7 @@ typedef struct zfs_zevent {
|
||||
extern void fm_init(void);
|
||||
extern void fm_fini(void);
|
||||
extern void fm_nvprint(nvlist_t *);
|
||||
extern void zfs_zevent_post_cb(nvlist_t *nvl, nvlist_t *detector);
|
||||
extern int zfs_zevent_post(nvlist_t *, nvlist_t *, zevent_cb_t *);
|
||||
extern void zfs_zevent_drain_all(int *);
|
||||
extern int zfs_zevent_fd_hold(int, minor_t *, zfs_zevent_t **);
|
||||
|
||||
+36
-1
@@ -23,7 +23,8 @@
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2014 by Delphix. All rights reserved.
|
||||
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
|
||||
* Copyright (c) 2013, 2017 Joyent, Inc. All rights reserved.
|
||||
* Copyright (c) 2014 Integros [integros.com]
|
||||
* Copyright (c) 2017 Datto Inc.
|
||||
*/
|
||||
|
||||
@@ -1146,11 +1147,45 @@ typedef enum {
|
||||
* ZFS_EV_POOL_GUID DATA_TYPE_UINT64
|
||||
* ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional)
|
||||
* ZFS_EV_VDEV_GUID DATA_TYPE_UINT64
|
||||
*
|
||||
* ESC_ZFS_HISTORY_EVENT
|
||||
*
|
||||
* ZFS_EV_POOL_NAME DATA_TYPE_STRING
|
||||
* ZFS_EV_POOL_GUID DATA_TYPE_UINT64
|
||||
* ZFS_EV_HIST_TIME DATA_TYPE_UINT64 (optional)
|
||||
* ZFS_EV_HIST_CMD DATA_TYPE_STRING (optional)
|
||||
* ZFS_EV_HIST_WHO DATA_TYPE_UINT64 (optional)
|
||||
* ZFS_EV_HIST_ZONE DATA_TYPE_STRING (optional)
|
||||
* ZFS_EV_HIST_HOST DATA_TYPE_STRING (optional)
|
||||
* ZFS_EV_HIST_TXG DATA_TYPE_UINT64 (optional)
|
||||
* ZFS_EV_HIST_INT_EVENT DATA_TYPE_UINT64 (optional)
|
||||
* ZFS_EV_HIST_INT_STR DATA_TYPE_STRING (optional)
|
||||
* ZFS_EV_HIST_INT_NAME DATA_TYPE_STRING (optional)
|
||||
* ZFS_EV_HIST_IOCTL DATA_TYPE_STRING (optional)
|
||||
* ZFS_EV_HIST_DSNAME DATA_TYPE_STRING (optional)
|
||||
* ZFS_EV_HIST_DSID DATA_TYPE_UINT64 (optional)
|
||||
*
|
||||
* The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the
|
||||
* history log nvlist. The keynames will be free of any spaces or other
|
||||
* characters that could be potentially unexpected to consumers of the
|
||||
* sysevents.
|
||||
*/
|
||||
#define ZFS_EV_POOL_NAME "pool_name"
|
||||
#define ZFS_EV_POOL_GUID "pool_guid"
|
||||
#define ZFS_EV_VDEV_PATH "vdev_path"
|
||||
#define ZFS_EV_VDEV_GUID "vdev_guid"
|
||||
#define ZFS_EV_HIST_TIME "history_time"
|
||||
#define ZFS_EV_HIST_CMD "history_command"
|
||||
#define ZFS_EV_HIST_WHO "history_who"
|
||||
#define ZFS_EV_HIST_ZONE "history_zone"
|
||||
#define ZFS_EV_HIST_HOST "history_hostname"
|
||||
#define ZFS_EV_HIST_TXG "history_txg"
|
||||
#define ZFS_EV_HIST_INT_EVENT "history_internal_event"
|
||||
#define ZFS_EV_HIST_INT_STR "history_internal_str"
|
||||
#define ZFS_EV_HIST_INT_NAME "history_internal_name"
|
||||
#define ZFS_EV_HIST_IOCTL "history_ioctl"
|
||||
#define ZFS_EV_HIST_DSNAME "history_dsname"
|
||||
#define ZFS_EV_HIST_DSID "history_dsid"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+6
-2
@@ -24,6 +24,8 @@
|
||||
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
|
||||
* Copyright 2013 Saso Kiselkov. All rights reserved.
|
||||
* Copyright (c) 2014 Integros [integros.com]
|
||||
* Copyright 2017 Joyent, Inc.
|
||||
* Copyright (c) 2017 Datto Inc.
|
||||
*/
|
||||
|
||||
@@ -882,10 +884,11 @@ struct zbookmark_phys;
|
||||
extern void spa_log_error(spa_t *spa, zio_t *zio);
|
||||
extern void zfs_ereport_post(const char *class, spa_t *spa, vdev_t *vd,
|
||||
zio_t *zio, uint64_t stateoroffset, uint64_t length);
|
||||
extern nvlist_t *zfs_event_create(spa_t *spa, vdev_t *vd, const char *type,
|
||||
const char *name, nvlist_t *aux);
|
||||
extern void zfs_post_remove(spa_t *spa, vdev_t *vd);
|
||||
extern void zfs_post_state_change(spa_t *spa, vdev_t *vd, uint64_t laststate);
|
||||
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);
|
||||
@@ -909,7 +912,8 @@ extern void spa_prop_clear_bootfs(spa_t *spa, uint64_t obj, dmu_tx_t *tx);
|
||||
extern void spa_configfile_set(spa_t *, nvlist_t *, boolean_t);
|
||||
|
||||
/* asynchronous event notification */
|
||||
extern void spa_event_notify(spa_t *spa, vdev_t *vdev, const char *name);
|
||||
extern void spa_event_notify(spa_t *spa, vdev_t *vdev, nvlist_t *hist_nvl,
|
||||
const char *name);
|
||||
|
||||
#ifdef ZFS_DEBUG
|
||||
#define dprintf_bp(bp, fmt, ...) do { \
|
||||
|
||||
@@ -27,4 +27,10 @@
|
||||
#ifndef _SYS_SYSEVENT_H
|
||||
#define _SYS_SYSEVENT_H
|
||||
|
||||
#include <sys/nvpair.h>
|
||||
|
||||
typedef struct sysevent {
|
||||
nvlist_t *resource;
|
||||
} sysevent_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright 2017 Joyent, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SYSEVENT_EVENTDEFS_H
|
||||
@@ -112,6 +113,7 @@ extern "C" {
|
||||
#define ESC_ZFS_VDEV_AUTOEXPAND "vdev_autoexpand"
|
||||
#define ESC_ZFS_BOOTFS_VDEV_ATTACH "bootfs_vdev_attach"
|
||||
#define ESC_ZFS_POOL_REGUID "pool_reguid"
|
||||
#define ESC_ZFS_HISTORY_EVENT "history_event"
|
||||
|
||||
/*
|
||||
* datalink subclass definitions.
|
||||
|
||||
Reference in New Issue
Block a user