Merge commit 'refs/top-bases/linux-zpios' into linux-zpios

Conflicts:

	configure.ac
	scripts/Makefile.am
This commit is contained in:
Brian Behlendorf 2009-08-17 21:46:51 -07:00
commit 48107741cd
26 changed files with 210 additions and 152 deletions

View File

@ -36,21 +36,58 @@ AC_DEFUN([ZFS_AC_DEBUG], [
]) ])
AC_DEFUN([ZFS_AC_CONFIG_SCRIPT], [ AC_DEFUN([ZFS_AC_CONFIG_SCRIPT], [
SCRIPT_CONFIG=.script-config cat >.script-config <<EOF
rm -f ${SCRIPT_CONFIG} KERNELSRC=${LINUX}
echo "KERNELSRC=${LINUX}" >>${SCRIPT_CONFIG} KERNELBUILD=${LINUX_OBJ}
echo "KERNELBUILD=${LINUX_OBJ}" >>${SCRIPT_CONFIG} KERNELSRCVER=${LINUX_VERSION}
echo "KERNELSRCVER=${LINUX_VERSION}" >>${SCRIPT_CONFIG} KERNELMOD=/lib/modules/\${KERNELSRCVER}/kernel
echo >>${SCRIPT_CONFIG}
echo "SPLSRC=${SPL}" >>${SCRIPT_CONFIG} SPLSRC=${SPL}
echo "SPLBUILD=${SPL_OBJ}" >>${SCRIPT_CONFIG} SPLBUILD=${SPL_OBJ}
echo "SPLSRCVER=${SPL_VERSION}" >>${SCRIPT_CONFIG} SPLSRCVER=${SPL_VERSION}
echo >>${SCRIPT_CONFIG}
echo "TOPDIR=${TOPDIR}" >>${SCRIPT_CONFIG} TOPDIR=${TOPDIR}
echo "BUILDDIR=${BUILDDIR}" >>${SCRIPT_CONFIG} BUILDDIR=${BUILDDIR}
echo "LIBDIR=${LIBDIR}" >>${SCRIPT_CONFIG} LIBDIR=${LIBDIR}
echo "CMDDIR=${CMDDIR}" >>${SCRIPT_CONFIG} CMDDIR=${CMDDIR}
echo "MODDIR=${MODDIR}" >>${SCRIPT_CONFIG} MODDIR=${MODDIR}
SCRIPTDIR=${SCRIPTDIR}
ZPOOLDIR=\${TOPDIR}/scripts/zpool-config
ZDB=\${CMDDIR}/zdb/zdb
ZFS=\${CMDDIR}/zfs/zfs
ZINJECT=\${CMDDIR}/zinject/zinject
ZPOOL=\${CMDDIR}/zpool/zpool
ZTEST=\${CMDDIR}/ztest/ztest
COMMON_SH=\${SCRIPTDIR}/common.sh
ZFS_SH=\${SCRIPTDIR}/zfs.sh
ZPOOL_CREATE_SH=\${SCRIPTDIR}/zpool-create.sh
LDMOD=/sbin/insmod
KERNEL_MODULES=( \\
\${KERNELMOD}/lib/zlib_deflate/zlib_deflate.ko \\
)
SPL_MODULES=( \\
\${SPLBUILD}/spl/spl.ko \\
)
ZFS_MODULES=( \\
\${MODDIR}/avl/zavl.ko \\
\${MODDIR}/nvpair/znvpair.ko \\
\${MODDIR}/unicode/zunicode.ko \\
\${MODDIR}/zcommon/zcommon.ko \\
\${MODDIR}/zfs/zfs.ko \\
)
MODULES=( \\
\${KERNEL_MODULES[[*]]} \\
\${SPL_MODULES[[*]]} \\
\${ZFS_MODULES[[*]]} \\
)
EOF
]) ])
AC_DEFUN([ZFS_AC_CONFIG], [ AC_DEFUN([ZFS_AC_CONFIG], [
@ -59,12 +96,14 @@ AC_DEFUN([ZFS_AC_CONFIG], [
LIBDIR=$TOPDIR/lib LIBDIR=$TOPDIR/lib
CMDDIR=$TOPDIR/cmd CMDDIR=$TOPDIR/cmd
MODDIR=$TOPDIR/module MODDIR=$TOPDIR/module
SCRIPTDIR=$TOPDIR/scripts
AC_SUBST(TOPDIR) AC_SUBST(TOPDIR)
AC_SUBST(BUILDDIR) AC_SUBST(BUILDDIR)
AC_SUBST(LIBDIR) AC_SUBST(LIBDIR)
AC_SUBST(CMDDIR) AC_SUBST(CMDDIR)
AC_SUBST(MODDIR) AC_SUBST(MODDIR)
AC_SUBST(SCRIPTDIR)
ZFS_CONFIG=all ZFS_CONFIG=all
AC_ARG_WITH([config], AC_ARG_WITH([config],

View File

@ -76,9 +76,6 @@ AC_CONFIG_FILES([
module/zfs/Makefile module/zfs/Makefile
module/zpios/Makefile module/zpios/Makefile
scripts/Makefile scripts/Makefile
scripts/zpool-config/Makefile
scripts/zpios-test/Makefile
scripts/zpios-profile/Makefile
zfs.spec zfs.spec
zfs-modules.spec zfs-modules.spec
]) ])

View File

@ -1,6 +1,9 @@
SUBDIRS = zpool-config zpios-test zpios-profile pkglibexecdir = $(libexecdir)/@PACKAGE@
EXTRA_DIST = common.sh zfs-update.sh zfs.sh zpool-create.sh nobase_pkglibexec_SCRIPTS = common.sh
EXTRA_DIST += zpios.sh zpios-survey.sh nobase_pkglibexec_SCRIPTS += zfs.sh
nobase_pkglibexec_SCRIPTS += zpool-create.sh
nobase_pkglibexec_SCRIPTS += zpool-config/*
EXTRA_DIST = zfs-update.sh $(nobase_pkglibexec_SCRIPTS)
ZFS=${top_srcdir}/scripts/zfs.sh ZFS=${top_srcdir}/scripts/zfs.sh
ZTEST=${top_builddir}/cmd/ztest/ztest ZTEST=${top_builddir}/cmd/ztest/ztest

View File

@ -1,24 +1,41 @@
#!/bin/bash #!/bin/bash
# #
# A simple script to simply the loading/unloading the ZFS module # Common support functions for testing scripts. If a .script-config
# stack. It should probably be considered a first step towards # files is available it will be sourced so in-tree kernel modules and
# a full ZFS init script when that is needed. # utilities will be used. If no .script-config can be found then the
# # installed kernel modules and utilities will be used.
if [ ! -f ../.script-config ]; then SCRIPT_CONFIG=.script-config
echo "You must build your source tree" if [ -f ../${SCRIPT_CONFIG} ]; then
exit 1 . ../${SCRIPT_CONFIG}
else
MODULES=(zlib_deflate spl zavl znvpair zunicode zcommon zfs)
fi fi
. ../.script-config
PROG="<define PROG>" PROG="<define PROG>"
VERBOSE= VERBOSE=
VERBOSE_FLAG= VERBOSE_FLAG=
DUMP_LOG= DUMP_LOG=
ERROR= ERROR=
MODULES=()
LOSETUP=/sbin/losetup ZPOOLDIR=${ZPOOLDIR:-/usr/libexec/zfs/zpool-config}
ZDB=${ZDB:-/usr/sbin/zdb}
ZFS=${ZFS:-/usr/sbin/zfs}
ZINJECT=${ZINJECT:-/usr/sbin/zinject}
ZPOOL=${ZPOOL:-/usr/sbin/zpool}
ZTEST=${ZTEST:-/usr/sbin/ztest}
COMMON_SH=${COMMON_SH:-/usr/libexec/zfs/common.sh}
ZFS_SH=${ZFS_SH:-/usr/libexec/zfs/zfs.sh}
ZPOOL_CREATE_SH=${ZPOOL_CREATE_SH:-/usr/libexec/zfs/zpool-create.sh}
LDMOD=${LDMOD:-/sbin/modprobe}
LSMOD=${LSMOD:-/sbin/lsmod}
RMMOD=${RMMOD:-/sbin/rmmod}
INFOMOD=${INFOMOD:-/sbin/modinfo}
LOSETUP=${LOSETUP:-/sbin/losetup}
SYSCTL=${SYSCTL:-/sbin/sysctl}
die() { die() {
echo -e "${PROG}: $1" >&2 echo -e "${PROG}: $1" >&2
@ -32,7 +49,7 @@ msg() {
} }
spl_dump_log() { spl_dump_log() {
sysctl -w kernel.spl.debug.dump=1 &>/dev/null ${SYSCTL} -w kernel.spl.debug.dump=1 &>/dev/null
local NAME=`dmesg | tail -n 1 | cut -f5 -d' '` local NAME=`dmesg | tail -n 1 | cut -f5 -d' '`
${SPLBUILD}/cmd/spl ${NAME} >${NAME}.log ${SPLBUILD}/cmd/spl ${NAME} >${NAME}.log
echo echo
@ -49,11 +66,11 @@ check_modules() {
for MOD in ${MODULES[*]}; do for MOD in ${MODULES[*]}; do
local NAME=`basename $MOD .ko` local NAME=`basename $MOD .ko`
if /sbin/lsmod | egrep -q "^${NAME}"; then if ${LSMOD} | egrep -q "^${NAME}"; then
LOADED_MODULES=(${NAME} ${LOADED_MODULES[*]}) LOADED_MODULES=(${NAME} ${LOADED_MODULES[*]})
fi fi
if [ ! -f ${MOD} ]; then if [ ${INFOMOD} ${MOD} 2>/dev/null ]; then
MISSING_MODULES=("\t${MOD}\n" ${MISSING_MODULES[*]}) MISSING_MODULES=("\t${MOD}\n" ${MISSING_MODULES[*]})
fi fi
done done
@ -78,10 +95,10 @@ load_module() {
local NAME=`basename $1 .ko` local NAME=`basename $1 .ko`
if [ ${VERBOSE} ]; then if [ ${VERBOSE} ]; then
echo "Loading $NAME ($@)" echo "Loading ${NAME} ($@)"
fi fi
/sbin/insmod $* || ERROR="Failed to load $1" return 1 ${LDMOD} $* || ERROR="Failed to load $1" return 1
return 0 return 0
} }
@ -114,10 +131,10 @@ unload_module() {
local NAME=`basename $1 .ko` local NAME=`basename $1 .ko`
if [ ${VERBOSE} ]; then if [ ${VERBOSE} ]; then
echo "Unloading $NAME ($@)" echo "Unloading ${NAME} ($@)"
fi fi
/sbin/rmmod $NAME || ERROR="Failed to unload $NAME" return 1 ${RMMOD} ${NAME} || ERROR="Failed to unload ${NAME}" return 1
return 0 return 0
} }
@ -129,7 +146,7 @@ unload_modules() {
for MOD in ${MODULES_REVERSE[*]}; do for MOD in ${MODULES_REVERSE[*]}; do
local NAME=`basename ${MOD} .ko` local NAME=`basename ${MOD} .ko`
if /sbin/lsmod | egrep -q "^${NAME}"; then if ${LSMOD} | egrep -q "^${NAME}"; then
if [ "${DUMP_LOG}" -a ${NAME} = "spl" ]; then if [ "${DUMP_LOG}" -a ${NAME} = "spl" ]; then
spl_dump_log spl_dump_log

View File

@ -1,35 +1,18 @@
#!/bin/bash #!/bin/bash
# #
# A simple script to simply the loading/unloading the ZFS module # A simple script to simply the loading/unloading the ZFS module stack.
# stack. It should probably be considered a first step towards
# a full ZFS init script when that is needed. SCRIPT_COMMON=common.sh
# if [ -f ./${SCRIPT_COMMON} ]; then
. ./${SCRIPT_COMMON}
elif [ -f /usr/libexec/zfs/${SCRIPT_COMMON} ]; then
. /usr/libexec/zfs/${SCRIPT_COMMON}
else
echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
fi
. ./common.sh
PROG=zfs.sh PROG=zfs.sh
UNLOAD=
KMOD=/lib/modules/${KERNELSRCVER}/kernel
KERNEL_MODULES=( \
$KMOD/lib/zlib_deflate/zlib_deflate.ko \
)
SPL_MODULES=( \
${SPLBUILD}/spl/spl.ko \
)
ZFS_MODULES=( \
${MODDIR}/avl/zavl.ko \
${MODDIR}/nvpair/znvpair.ko \
${MODDIR}/unicode/zunicode.ko \
${MODDIR}/zcommon/zcommon.ko \
${MODDIR}/zfs/zfs.ko \
)
MODULES=( \
${KERNEL_MODULES[*]} \
${SPL_MODULES[*]} \
${ZFS_MODULES[*]} \
)
usage() { usage() {
cat << EOF cat << EOF
@ -55,8 +38,6 @@ $0 spl="spl_debug_mask=0"
EOF EOF
} }
UNLOAD=
while getopts 'hvud' OPTION; do while getopts 'hvud' OPTION; do
case $OPTION in case $OPTION in
h) h)

View File

@ -1 +0,0 @@
EXTRA_DIST = *.sh

View File

@ -16,13 +16,13 @@ zpool_create() {
die "Error $? creating ${FILE}" die "Error $? creating ${FILE}"
done done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${FILES} msg ${ZPOOL} create ${ZPOOL_NAME} ${FILES}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${FILES} || exit 1 ${ZPOOL} create ${ZPOOL_NAME} ${FILES} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do for FILE in ${FILES}; do
msg "Removing ${FILE}" msg "Removing ${FILE}"

View File

@ -17,15 +17,15 @@ zpool_create() {
die "Error $? creating ${FILE}" die "Error $? creating ${FILE}"
done done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \ msg ${ZPOOL} create ${ZPOOL_NAME} \
mirror ${FILES_M1} mirror ${FILES_M2} mirror ${FILES_M1} mirror ${FILES_M2}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \ ${ZPOOL} create ${ZPOOL_NAME} \
mirror ${FILES_M1} mirror ${FILES_M2} || exit 1 mirror ${FILES_M1} mirror ${FILES_M2} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do for FILE in ${FILES}; do
msg "Removing ${FILE}" msg "Removing ${FILE}"

View File

@ -16,13 +16,13 @@ zpool_create() {
die "Error $? creating ${FILE}" die "Error $? creating ${FILE}"
done done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz ${FILES} msg ${ZPOOL} create ${ZPOOL_NAME} raidz ${FILES}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz ${FILES} || exit 1 ${ZPOOL} create ${ZPOOL_NAME} raidz ${FILES} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do for FILE in ${FILES}; do
msg "Removing ${FILE}" msg "Removing ${FILE}"

View File

@ -16,13 +16,13 @@ zpool_create() {
die "Error $? creating ${FILE}" die "Error $? creating ${FILE}"
done done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz2 ${FILES} msg ${ZPOOL} create ${ZPOOL_NAME} raidz2 ${FILES}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz2 ${FILES} || exit 1 ${ZPOOL} create ${ZPOOL_NAME} raidz2 ${FILES} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do for FILE in ${FILES}; do
msg "Removing ${FILE}" msg "Removing ${FILE}"

View File

@ -6,11 +6,11 @@
DEVICES="/dev/hda" DEVICES="/dev/hda"
zpool_create() { zpool_create() {
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} msg ${ZPOOL} create -f ${ZPOOL_NAME} ${DEVICES}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} || exit 1 ${ZPOOL} create -f ${ZPOOL_NAME} ${DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} || exit 1 ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1
} }

View File

@ -21,13 +21,13 @@ zpool_create() {
DEVICES="${DEVICES} ${DEVICE}" DEVICES="${DEVICES} ${DEVICE}"
done done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${DEVICES} msg ${ZPOOL} create ${ZPOOL_NAME} ${DEVICES}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${DEVICES} || exit 1 ${ZPOOL} create ${ZPOOL_NAME} ${DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do for FILE in ${FILES}; do
DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`

View File

@ -34,15 +34,15 @@ zpool_create() {
DEVICES_M2="${DEVICES_M2} ${DEVICE}" DEVICES_M2="${DEVICES_M2} ${DEVICE}"
done done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \ msg ${ZPOOL} create ${ZPOOL_NAME} \
mirror ${DEVICES_M1} mirror ${DEVICES_M2} mirror ${DEVICES_M1} mirror ${DEVICES_M2}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \ ${ZPOOL} create ${ZPOOL_NAME} \
mirror ${DEVICES_M1} mirror ${DEVICES_M2} mirror ${DEVICES_M1} mirror ${DEVICES_M2}
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do for FILE in ${FILES}; do
DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`

View File

@ -21,13 +21,13 @@ zpool_create() {
DEVICES="${DEVICES} ${DEVICE}" DEVICES="${DEVICES} ${DEVICE}"
done done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz ${DEVICES} msg ${ZPOOL} create ${ZPOOL_NAME} raidz ${DEVICES}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz ${DEVICES} || exit 1 ${ZPOOL} create ${ZPOOL_NAME} raidz ${DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do for FILE in ${FILES}; do
DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`

View File

@ -21,13 +21,13 @@ zpool_create() {
DEVICES="${DEVICES} ${DEVICE}" DEVICES="${DEVICES} ${DEVICE}"
done done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz2 ${DEVICES} msg ${ZPOOL} create ${ZPOOL_NAME} raidz2 ${DEVICES}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz2 ${DEVICES} || exit 1 ${ZPOOL} create ${ZPOOL_NAME} raidz2 ${DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do for FILE in ${FILES}; do
DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`

View File

@ -6,11 +6,11 @@
DEVICES="/dev/sda" DEVICES="/dev/sda"
zpool_create() { zpool_create() {
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} msg ${ZPOOL} create -f ${ZPOOL_NAME} ${DEVICES}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} || exit 1 ${ZPOOL} create -f ${ZPOOL_NAME} ${DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} || exit 1 ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1
} }

View File

@ -16,11 +16,11 @@ zpool_create() {
let S_IDX=S_IDX+1 let S_IDX=S_IDX+1
done done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${STRIPES[*]} msg ${ZPOOL} create -f ${ZPOOL_NAME} ${STRIPES[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${STRIPES[*]} || exit 1 ${ZPOOL} create -f ${ZPOOL_NAME} ${STRIPES[*]} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
} }

View File

@ -43,11 +43,11 @@ zpool_create() {
let M_IDX=M_IDX+1 let M_IDX=M_IDX+1
done done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} msg ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1 ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
} }

View File

@ -36,11 +36,11 @@ zpool_create() {
let M_IDX=M_IDX+1 let M_IDX=M_IDX+1
done done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} msg ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1 ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
} }

View File

@ -29,11 +29,11 @@ zpool_create() {
let M_IDX=M_IDX+1 let M_IDX=M_IDX+1
done done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} msg ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1 ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
} }

View File

@ -33,11 +33,11 @@ zpool_create() {
let Z_IDX=Z_IDX+1 let Z_IDX=Z_IDX+1
done done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZS[*]} msg ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZS[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1 ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
} }

View File

@ -33,11 +33,11 @@ zpool_create() {
let Z_IDX=Z_IDX+1 let Z_IDX=Z_IDX+1
done done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZS[*]} msg ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZS[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1 ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
} }

View File

@ -33,11 +33,11 @@ zpool_create() {
let Z_IDX=Z_IDX+1 let Z_IDX=Z_IDX+1
done done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} msg ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1 ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
} }

View File

@ -33,11 +33,11 @@ zpool_create() {
let Z_IDX=Z_IDX+1 let Z_IDX=Z_IDX+1
done done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} msg ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1 ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${ZPOOL} destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME}
} }

View File

@ -1,6 +1,14 @@
#!/bin/bash #!/bin/bash
. ./common.sh SCRIPT_COMMON=common.sh
if [ -f ./${SCRIPT_COMMON} ]; then
. ./${SCRIPT_COMMON}
elif [ -f /usr/libexec/zfs/${SCRIPT_COMMON} ]; then
. /usr/libexec/zfs/${SCRIPT_COMMON}
else
echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
fi
PROG=zpool-create.sh PROG=zpool-create.sh
usage() { usage() {
@ -29,7 +37,7 @@ check_config() {
local NAME=`basename ${ZPOOL_CONFIG} .sh` local NAME=`basename ${ZPOOL_CONFIG} .sh`
ERROR="Unknown config '${NAME}', available configs are:\n" ERROR="Unknown config '${NAME}', available configs are:\n"
for CFG in `ls ${TOPDIR}/scripts/zpool-config/`; do for CFG in `ls ${ZPOOLDIR}/ | grep ".sh"`; do
local NAME=`basename ${CFG} .sh` local NAME=`basename ${CFG} .sh`
ERROR="${ERROR}${NAME}\n" ERROR="${ERROR}${NAME}\n"
done done
@ -40,7 +48,7 @@ check_config() {
return 0 return 0
} }
ZPOOL_CONFIG=zpool_config.sh ZPOOL_CONFIG=unknown
ZPOOL_NAME=tank ZPOOL_NAME=tank
ZPOOL_DESTROY= ZPOOL_DESTROY=
ZPOOL_OPTIONS="" ZPOOL_OPTIONS=""
@ -56,7 +64,7 @@ while getopts 'hvc:p:dl:s:' OPTION; do
VERBOSE=1 VERBOSE=1
;; ;;
c) c)
ZPOOL_CONFIG=${TOPDIR}/scripts/zpool-config/${OPTARG}.sh ZPOOL_CONFIG=${ZPOOLDIR}/${OPTARG}.sh
;; ;;
p) p)
ZPOOL_NAME=${OPTARG} ZPOOL_NAME=${OPTARG}
@ -92,27 +100,27 @@ else
if [ "${ZPOOL_OPTIONS}" ]; then if [ "${ZPOOL_OPTIONS}" ]; then
if [ ${VERBOSE} ]; then if [ ${VERBOSE} ]; then
echo echo
echo "${CMDDIR}/zpool/zpool ${ZPOOL_OPTIONS} ${ZPOOL_NAME}" echo "${ZPOOL} ${ZPOOL_OPTIONS} ${ZPOOL_NAME}"
fi fi
${CMDDIR}/zpool/zpool ${ZPOOL_OPTIONS} ${ZPOOL_NAME} || exit 1 ${ZPOOL} ${ZPOOL_OPTIONS} ${ZPOOL_NAME} || exit 1
fi fi
if [ "${ZFS_OPTIONS}" ]; then if [ "${ZFS_OPTIONS}" ]; then
if [ ${VERBOSE} ]; then if [ ${VERBOSE} ]; then
echo echo
echo "${CMDDIR}/zfs/zfs ${ZFS_OPTIONS} ${ZPOOL_NAME}" echo "${ZFS} ${ZFS_OPTIONS} ${ZPOOL_NAME}"
fi fi
${CMDDIR}/zfs/zfs ${ZFS_OPTIONS} ${ZPOOL_NAME} || exit 1 ${ZFS} ${ZFS_OPTIONS} ${ZPOOL_NAME} || exit 1
fi fi
if [ ${VERBOSE} ]; then if [ ${VERBOSE} ]; then
echo echo
echo "zpool list" echo "zpool list"
${CMDDIR}/zpool/zpool list || exit 1 ${ZPOOL} list || exit 1
echo echo
echo "zpool status ${ZPOOL_NAME}" echo "zpool status ${ZPOOL_NAME}"
${CMDDIR}/zpool/zpool status ${ZPOOL_NAME} || exit 1 ${ZPOOL} status ${ZPOOL_NAME} || exit 1
fi fi
fi fi

View File

@ -29,6 +29,16 @@ BuildRequires: zlib-devel
The %{name}-devel package contains the header files needed for building The %{name}-devel package contains the header files needed for building
additional applications against the %{name} libraries. additional applications against the %{name} libraries.
%package test
Summary: ZFS File System Test Infrastructure
Group: Utilities/System
%description test
The %{name}-test package contains a test infrastructure for zpios which
can be used to simplfy the benchmarking of various hardware and software
configurations. The test infrastructure additionally integrates with
various system profiling tools to facilitate an in depth analysis.
%prep %prep
%setup %setup
%build %build
@ -53,5 +63,9 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root) %defattr(-,root,root)
%{_includedir}/* %{_includedir}/*
%files test
%defattr(-,root,root)
%{_libexecdir}/@PACKAGE@/*
%post %post
%postun %postun