mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Add zpool events tests
* 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 <behlendorf1@llnl.gov> Closes #6128
This commit is contained in:
@@ -0,0 +1 @@
|
||||
/default.cfg
|
||||
@@ -6,3 +6,8 @@ dist_pkgdata_SCRIPTS = \
|
||||
math.shlib \
|
||||
properties.shlib \
|
||||
zpool_script.shlib
|
||||
|
||||
EXTRA_DIST=default.cfg.in
|
||||
|
||||
distclean-local::
|
||||
-$(RM) $(dist_pkgdata_SCRIPTS)
|
||||
|
||||
@@ -33,8 +33,11 @@
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
# ZFS Directories
|
||||
export ZEDLETDIR=${ZEDLETDIR:-/etc/zfs/zed.d}
|
||||
export ZPOOLSCRIPTDIR=${ZPOOLSCRIPTDIR:-/etc/zfs/zpool.d}
|
||||
export prefix=@prefix@
|
||||
export exec_prefix=@exec_prefix@
|
||||
export ZEDLET_ETC_DIR=${ZEDLET_ETC_DIR:-@sysconfdir@/zfs/zed.d}
|
||||
export ZEDLET_LIBEXEC_DIR=${ZEDLET_LIBEXEC_DIR:-@libexecdir@/zfs/zed.d}
|
||||
export ZPOOL_SCRIPT_DIR=${ZPOOL_SCRIPT_DIR:-@sysconfdir@/zfs/zpool.d}
|
||||
|
||||
# Define run length constants
|
||||
export RT_LONG="3"
|
||||
@@ -3280,11 +3280,16 @@ function zed_setup
|
||||
|
||||
# Setup minimal ZED configuration. Individual test cases should
|
||||
# add additional ZEDLETs as needed for their specific test.
|
||||
log_must cp ${ZEDLETDIR}/zed.rc $ZEDLET_DIR
|
||||
log_must cp ${ZEDLETDIR}/zed-functions.sh $ZEDLET_DIR
|
||||
log_must cp ${ZEDLETDIR}/all-syslog.sh $ZEDLET_DIR
|
||||
log_must cp ${ZEDLET_ETC_DIR}/zed.rc $ZEDLET_DIR
|
||||
log_must cp ${ZEDLET_ETC_DIR}/zed-functions.sh $ZEDLET_DIR
|
||||
|
||||
log_must zpool events -c
|
||||
# Customize the zed.rc file to enable the full debug log.
|
||||
log_must sed -i '/\#ZED_DEBUG_LOG=.*/d' $ZEDLET_DIR/zed.rc
|
||||
echo "ZED_DEBUG_LOG=$ZEDLET_DIR/zed.debug.log" >>$ZEDLET_DIR/zed.rc
|
||||
|
||||
log_must cp ${ZEDLET_LIBEXEC_DIR}/all-syslog.sh $ZEDLET_DIR
|
||||
log_must cp ${ZEDLET_LIBEXEC_DIR}/all-debug.sh $ZEDLET_DIR
|
||||
log_must touch $ZEDLET_DIR/zed.debug.log
|
||||
}
|
||||
|
||||
#
|
||||
@@ -3299,8 +3304,10 @@ function zed_cleanup
|
||||
log_must rm -f ${ZEDLET_DIR}/zed.rc
|
||||
log_must rm -f ${ZEDLET_DIR}/zed-functions.sh
|
||||
log_must rm -f ${ZEDLET_DIR}/all-syslog.sh
|
||||
log_must rm -f ${ZEDLET_DIR}/all-debug.sh
|
||||
log_must rm -f ${ZEDLET_DIR}/zed.pid
|
||||
log_must rm -f ${ZEDLET_DIR}/zedlog
|
||||
log_must rm -f ${ZEDLET_DIR}/zed.debug.log
|
||||
log_must rm -f ${ZEDLET_DIR}/state
|
||||
log_must rm -f $VDEVID_CONF_ETC
|
||||
log_must rm -f $VDEVID_CONF
|
||||
@@ -3332,6 +3339,8 @@ function zed_start
|
||||
# output to zedlog
|
||||
log_must eval "zed -vF -d $ZEDLET_DIR -p $ZEDLET_DIR/zed.pid" \
|
||||
"-s $ZEDLET_DIR/state 2>${ZEDLET_DIR}/zedlog &"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
@@ -3343,10 +3352,13 @@ function zed_stop
|
||||
return
|
||||
fi
|
||||
|
||||
log_note "Stopping ZED"
|
||||
if [[ -f ${ZEDLET_DIR}/zed.pid ]]; then
|
||||
zedpid=$(cat ${ZEDLET_DIR}/zed.pid)
|
||||
log_must kill $zedpid
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user