-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* events_001_pos - Verify the expected events are generated when invoking the various zpool sub-commands. These events must appear in `zpool event` and be consumed by the ZED. * events_002_pos - Verify the ZED consumes events which were generated while it wasn't running when it is started. Additionally, verify that events are only processed once. As part of this change the default.cfg used by the test suite was changed to a default.cfg.in file. This was needed so the install location of all zed scripts, not only the enabled ones, could be reliably determined. Signed-off-by: Brian Behlendorf <[email protected]> Closes #6128
- Loading branch information
1 parent
5a6d6cf
commit 3f03fc8
Showing
18 changed files
with
487 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/default.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ SUBDIRS = \ | |
ctime \ | ||
delegate \ | ||
devices \ | ||
events \ | ||
exec \ | ||
fault \ | ||
features \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/events | ||
dist_pkgdata_SCRIPTS = \ | ||
setup.ksh \ | ||
cleanup.ksh \ | ||
events.cfg \ | ||
events_common.kshlib \ | ||
events_001_pos.ksh \ | ||
events_002_pos.ksh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/ksh -p | ||
# | ||
# 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) 2017 by Lawrence Livermore National Security, LLC. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
|
||
zed_cleanup | ||
|
||
default_cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# | ||
# 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) 2017 by Lawrence Livermore National Security, LLC. | ||
# Use is subject to license terms. | ||
# | ||
|
||
export MPOOL=mpool.$$ | ||
|
||
VDEV1=$TEST_BASE_DIR/vdev1 | ||
VDEV2=$TEST_BASE_DIR/vdev2 | ||
VDEV3=$TEST_BASE_DIR/vdev3 | ||
VDEV4=$TEST_BASE_DIR/vdev4 | ||
|
||
export TMP_EVENTS=/tmp/tmp_events.$$ | ||
export TMP_EVENTS_FULL=/tmp/tmp_events_full.$$ | ||
export TMP_EVENT_FULL=/tmp/tmp_event_full.$$ | ||
export TMP_EVENTS_ZED=/tmp/tmp_events_zed.$$ | ||
export TMP_EVENT_ZED=/tmp/tmp_event_zed.$$ |
134 changes: 134 additions & 0 deletions
134
tests/zfs-tests/tests/functional/events/events_001_pos.ksh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
#!/bin/ksh -p | ||
# | ||
# 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) 2017 by Lawrence Livermore National Security, LLC. | ||
# Use is subject to license terms. | ||
# | ||
|
||
# DESCRIPTION: | ||
# Verify zpool events command logs events. | ||
# | ||
# STRATEGY: | ||
# 1. Execute zpool sub-commands on a pool. | ||
# 2. Verify the expected events are logged in 'zpool events'. | ||
# 3. Verify the expected events are logged by the ZED. | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
. $STF_SUITE/tests/functional/events/events_common.kshlib | ||
|
||
verify_runnable "both" | ||
|
||
function cleanup | ||
{ | ||
if poolexists $MPOOL; then | ||
destroy_pool $MPOOL | ||
fi | ||
|
||
for file in $VDEV1 $VDEV2 $VDEV3 $VDEV4; do | ||
[[ -f $file ]] && rm -f $file | ||
done | ||
|
||
log_must zed_stop | ||
} | ||
|
||
log_assert "Verify zpool sub-commands generate expected events" | ||
log_onexit cleanup | ||
|
||
log_must truncate -s $MINVDEVSIZE $VDEV1 $VDEV2 $VDEV3 $VDEV4 | ||
log_must zed_start | ||
|
||
# Create a mirrored pool with two devices. | ||
run_and_verify -p "$MPOOL" \ | ||
-e "sysevent.fs.zfs.config_sync" \ | ||
-e "sysevent.fs.zfs.pool_create" \ | ||
"zpool create $MPOOL mirror $VDEV1 $VDEV2" | ||
|
||
# Add a cache device then remove it. | ||
run_and_verify -p "$MPOOL" \ | ||
-e "sysevent.fs.zfs.config_sync" \ | ||
-e "sysevent.fs.zfs.vdev_add" \ | ||
"zpool add -f $MPOOL spare $VDEV3" | ||
run_and_verify -p "$MPOOL" \ | ||
-e "sysevent.fs.zfs.vdev_remove_aux" \ | ||
"zpool remove $MPOOL $VDEV3" | ||
|
||
# Add a log device then remove it. | ||
run_and_verify -p "$MPOOL" \ | ||
-e "sysevent.fs.zfs.config_sync" \ | ||
-e "sysevent.fs.zfs.vdev_add" \ | ||
"zpool add -f $MPOOL log $VDEV3" | ||
run_and_verify -p "$MPOOL" \ | ||
-e "sysevent.fs.zfs.vdev_remove_dev" \ | ||
"zpool remove $MPOOL $VDEV3" | ||
|
||
# Offline then online a device. | ||
run_and_verify -p "$MPOOL"\ | ||
-e "resource.fs.zfs.statechange" \ | ||
-e "sysevent.fs.zfs.config_sync" \ | ||
"zpool offline $MPOOL $VDEV1" | ||
run_and_verify -p "$MPOOL" \ | ||
-e "resource.fs.zfs.statechange" \ | ||
-e "sysevent.fs.zfs.vdev_online" \ | ||
-e "sysevent.fs.zfs.config_sync" \ | ||
"zpool online $MPOOL $VDEV1" | ||
|
||
# Attach then detach a device from the mirror. | ||
run_and_verify -p "$MPOOL" \ | ||
-e "sysevent.fs.zfs.vdev_attach" \ | ||
"zpool attach $MPOOL $VDEV1 $VDEV4" | ||
run_and_verify -p "$MPOOL" \ | ||
-e "sysevent.fs.zfs.vdev_remove" \ | ||
-e "sysevent.fs.zfs.config_sync" \ | ||
"zpool detach $MPOOL $VDEV4" | ||
|
||
# Replace a device | ||
run_and_verify -p "$MPOOL" \ | ||
-e "sysevent.fs.zfs.vdev_attach" \ | ||
-e "sysevent.fs.zfs.resilver_start" \ | ||
-e "sysevent.fs.zfs.resilver_finish" \ | ||
-e "sysevent.fs.zfs.config_sync" \ | ||
"zpool replace -f $MPOOL $VDEV1 $VDEV4" | ||
|
||
# Scrub a pool. | ||
run_and_verify -p "$MPOOL" \ | ||
-e "sysevent.fs.zfs.scrub_start" \ | ||
-e "sysevent.fs.zfs.scrub_finish" \ | ||
"zpool scrub $MPOOL" | ||
|
||
# Export then import a pool (may change to a pool_export event) | ||
run_and_verify -p "$MPOOL" \ | ||
-e "sysevent.fs.zfs.pool_destroy" \ | ||
-e "sysevent.fs.zfs.config_sync" \ | ||
"zpool export $MPOOL" | ||
run_and_verify -p "$MPOOL" \ | ||
-e "sysevent.fs.zfs.pool_import" \ | ||
-e "sysevent.fs.zfs.config_sync" \ | ||
"zpool import -d $TEST_BASE_DIR $MPOOL" | ||
|
||
# Destroy the pool | ||
run_and_verify -p "$MPOOL" \ | ||
-e "sysevent.fs.zfs.pool_destroy" \ | ||
-e "sysevent.fs.zfs.config_sync" \ | ||
"zpool destroy $MPOOL" | ||
|
||
log_pass "Verify zpool sub-commands generate expected events" |
Oops, something went wrong.