]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/events/events_002_pos.ksh
b5cb3bb1d222681c0820b58fc1488f122fba2750
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright (c) 2017 by Lawrence Livermore National Security, LLC.
25 # Use is subject to license terms.
29 # Verify ZED handles missed events from a pool when starting.
32 # 1. Clear the events and create a pool to generate some events.
33 # 2. Start the ZED and verify it handles missed events.
35 # 4. Generate additional events.
36 # 5. Start the ZED and verify it only handles the new missed events.
38 .
$STF_SUITE/include
/libtest.shlib
39 .
$STF_SUITE/tests
/functional
/events
/events_common.kshlib
41 verify_runnable
"both"
45 if poolexists
$MPOOL; then
49 for file in $VDEV1 $VDEV2; do
50 [[ -f $file ]] && rm -f $file
53 log_must
rm -f $TMP_EVENTS_ZED $TMP_EVENTS_ZED
57 log_assert
"Verify ZED handles missed events on when starting"
60 log_must truncate
-s $MINVDEVSIZE $VDEV1 $VDEV2
62 # 1. Create a pool and generate some events.
63 log_must truncate
-s 0 $ZED_DEBUG_LOG
64 log_must zpool events
-c
65 log_must zpool create
$MPOOL mirror
$VDEV1 $VDEV2
67 # 2. Start the ZED and verify it handles missed events.
69 log_must file_wait
$ZED_DEBUG_LOG
70 log_must
cp $ZED_DEBUG_LOG $TMP_EVENTS_ZED
72 awk -v event
="sysevent.fs.zfs.pool_create" \
73 'BEGIN{FS="\n"; RS=""} $0 ~ event { print $0 }' \
74 $TMP_EVENTS_ZED >$TMP_EVENT_ZED
75 log_must
grep -q "^ZEVENT_POOL=$MPOOL" $TMP_EVENT_ZED
79 log_must truncate
-s 0 $ZED_DEBUG_LOG
81 # 4. Generate additional events.
82 log_must zpool offline
$MPOOL $VDEV1
83 log_must zpool online
$MPOOL $VDEV1
84 log_must zpool scrub
$MPOOL
86 # Wait for the scrub to wrap, or is_healthy will be wrong.
87 while ! is_pool_scrubbed
$MPOOL; do
91 # 5. Start the ZED and verify it only handled the new missed events.
93 log_must file_wait
$ZED_DEBUG_LOG 15
94 log_must
cp $ZED_DEBUG_LOG $TMP_EVENTS_ZED
96 log_mustnot
grep -q "sysevent.fs.zfs.pool_create" $TMP_EVENTS_ZED
97 log_must
grep -q "sysevent.fs.zfs.vdev_online" $TMP_EVENTS_ZED
98 log_must
grep -q "sysevent.fs.zfs.resilver_start" $TMP_EVENTS_ZED
99 log_must
grep -q "sysevent.fs.zfs.resilver_finish" $TMP_EVENTS_ZED
101 log_pass
"Verify ZED handles missed events on when starting"