Enable zpool events tunables and tests on FreeBSD

We have have made the necessary changes in our module code to expose
zevents through both devd and the zpool events ioctl. Now the tunables
can be exposed and zpool events tests can be enabled on both platforms.

A few minor tweaks to the tests were needed to accommodate the way wc
formats output on FreeBSD.

zed remains to be ported.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #10008
This commit is contained in:
Ryan Moeller 2020-02-18 14:22:56 -05:00 committed by GitHub
parent 8b3547a481
commit 5f087dda78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 23 additions and 25 deletions

View File

@ -70,6 +70,7 @@ enum scope_prefix_types {
zfs_vdev,
zfs_vdev_cache,
zfs_vdev_mirror,
zfs_zevent,
zfs_zio,
zfs_zil,
spa

View File

@ -1607,9 +1607,7 @@ fm_erpt_dropped_increment(void)
{
atomic_inc_64(&ratelimit_dropped);
}
#endif
#ifdef _KERNEL
void
fm_init(void)
{
@ -1664,14 +1662,13 @@ fm_fini(void)
fm_ksp = NULL;
}
}
module_param(zfs_zevent_len_max, int, 0644);
MODULE_PARM_DESC(zfs_zevent_len_max, "Max event queue length");
module_param(zfs_zevent_cols, int, 0644);
MODULE_PARM_DESC(zfs_zevent_cols, "Max event column width");
module_param(zfs_zevent_console, int, 0644);
MODULE_PARM_DESC(zfs_zevent_console, "Log events to the console");
#endif /* _KERNEL */
ZFS_MODULE_PARAM(zfs_zevent, zfs_zevent_, len_max, INT, ZMOD_RW,
"Max event queue length");
ZFS_MODULE_PARAM(zfs_zevent, zfs_zevent_, cols, INT, ZMOD_RW,
"Max event column width");
ZFS_MODULE_PARAM(zfs_zevent, zfs_zevent_, console, INT, ZMOD_RW,
"Log events to the console");

View File

@ -333,6 +333,11 @@ tags = ['functional', 'cli_root', 'zpool_destroy']
tests = ['zpool_detach_001_neg']
tags = ['functional', 'cli_root', 'zpool_detach']
[tests/functional/cli_root/zpool_events]
tests = ['zpool_events_clear', 'zpool_events_cliargs', 'zpool_events_follow',
'zpool_events_poolname', 'zpool_events_errors']
tags = ['functional', 'cli_root', 'zpool_events']
[tests/functional/cli_root/zpool_export]
tests = ['zpool_export_001_pos', 'zpool_export_002_pos',
'zpool_export_003_neg', 'zpool_export_004_pos']

View File

@ -59,11 +59,6 @@ tags = ['functional', 'cli_root', 'zfs_sysfs']
tests = ['add_nested_replacing_spare']
tags = ['functional', 'cli_root', 'zpool_add']
[tests/functional/cli_root/zpool_events:Linux]
tests = ['zpool_events_clear', 'zpool_events_cliargs', 'zpool_events_follow',
'zpool_events_poolname', 'zpool_events_errors']
tags = ['functional', 'cli_root', 'zpool_events']
[tests/functional/cli_root/zpool_expand:Linux]
tests = ['zpool_expand_001_pos', 'zpool_expand_002_pos',
'zpool_expand_003_neg', 'zpool_expand_004_pos', 'zpool_expand_005_pos']

View File

@ -73,7 +73,7 @@ VDEV_VALIDATE_SKIP vdev.validate_skip vdev_validate_skip
VOL_INHIBIT_DEV UNSUPPORTED zvol_inhibit_dev
VOL_MODE vol.mode zvol_volmode
VOL_RECURSIVE vol.recursive UNSUPPORTED
ZEVENT_LEN_MAX UNSUPPORTED zfs_zevent_len_max
ZEVENT_LEN_MAX zevent.len_max zfs_zevent_len_max
ZIO_SLOW_IO_MS zio.slow_io_ms zio_slow_io_ms
%%%%
while read name FreeBSD Linux; do

View File

@ -43,14 +43,14 @@ for i in `seq 1 $EVENTS_NUM`; do
done
# wait a bit to allow the kernel module to process new events
zpool_events_settle
EVENTS_NUM="$(zpool events -H | wc -l)"
EVENTS_NUM=$(zpool events -H | wc -l | xargs)
# 3. Verify 'zpool events -c' successfully clear new events
CLEAR_OUTPUT="$(zpool events -c)"
CLEAR_OUTPUT=$(zpool events -c)
if [[ "$CLEAR_OUTPUT" != "cleared $EVENTS_NUM events" ]]; then
log_fail "Failed to clear $EVENTS_NUM events: $CLEAR_OUTPUT"
fi
EVENTS_NUM="$(zpool events -H | wc -l)"
EVENTS_NUM=$(zpool events -H | wc -l)
if [[ $EVENTS_NUM -ne 0 ]]; then
log_fail "Unexpected events number: $EVENTS_NUM != 0"
fi

View File

@ -129,11 +129,11 @@ function do_test
fi
fi
if [ "$val" == "0" ] || [ "$events" == "" ] ; then
if [ -z "$val" -o $val -eq 0 -o -z "$events" -o $events -eq 0 ] ; then
log_fail "Didn't see any errors or events ($val/$events)"
fi
if [ "$val" != "$events" ] ; then
if [ $val -ne $events ] ; then
log_fail "$val $POOLTYPE $str errors != $events events"
else
log_note "$val $POOLTYPE $str errors == $events events"

View File

@ -56,8 +56,8 @@ done
zpool_events_settle
# 4. Verify 'zpool events -f' successfully recorded these new events
EVENTS_LOG="$(cat $EVENTS_FILE | wc -l)"
if [[ "$EVENTS_LOG" != "$EVENTS_NUM" ]]; then
EVENTS_LOG=$(cat $EVENTS_FILE | wc -l)
if [[ $EVENTS_LOG -ne $EVENTS_NUM ]]; then
log_fail "Unexpected number of events: $EVENTS_LOG != $EVENTS_NUM"
fi