mirror of
https://git.proxmox.com/git/mirror_zfs
synced 2025-04-29 15:20:28 +00:00
Fix zpool_import_all_001_pos
Cleanup zpool_import_all_001_pos to no longer use devices. The test is meant to test zpool import -a and by no longer requiring devices, a number of dependencies are no longer necessary. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov> Closes #6198
This commit is contained in:
parent
419c80e6dc
commit
1fbfcf1159
@ -49,7 +49,7 @@ verify_runnable "global"
|
|||||||
set -A options "" "-R $ALTER_ROOT"
|
set -A options "" "-R $ALTER_ROOT"
|
||||||
|
|
||||||
typeset -i number=0
|
typeset -i number=0
|
||||||
typeset -i id=0
|
typeset -i id=1
|
||||||
typeset -i i=0
|
typeset -i i=0
|
||||||
typeset checksum1
|
typeset checksum1
|
||||||
typeset unwantedpool
|
typeset unwantedpool
|
||||||
@ -62,9 +62,7 @@ function setup_single_disk #disk #pool #fs #mtpt
|
|||||||
typeset mtpt=$4
|
typeset mtpt=$4
|
||||||
|
|
||||||
setup_filesystem "$disk" "$pool" "$fs" "$mtpt"
|
setup_filesystem "$disk" "$pool" "$fs" "$mtpt"
|
||||||
|
|
||||||
log_must cp $MYTESTFILE $mtpt/$TESTFILE0
|
log_must cp $MYTESTFILE $mtpt/$TESTFILE0
|
||||||
|
|
||||||
log_must zpool export $pool
|
log_must zpool export $pool
|
||||||
|
|
||||||
[[ -d $mtpt ]] && \
|
[[ -d $mtpt ]] && \
|
||||||
@ -73,7 +71,7 @@ function setup_single_disk #disk #pool #fs #mtpt
|
|||||||
|
|
||||||
function cleanup_all
|
function cleanup_all
|
||||||
{
|
{
|
||||||
typeset -i id=0
|
typeset -i id=1
|
||||||
|
|
||||||
#
|
#
|
||||||
# Try import individually if 'import -a' failed.
|
# Try import individually if 'import -a' failed.
|
||||||
@ -87,27 +85,10 @@ function cleanup_all
|
|||||||
done
|
done
|
||||||
|
|
||||||
while (( id < number )); do
|
while (( id < number )); do
|
||||||
if ! poolexists ${TESTPOOL}-$id ; then
|
if poolexists ${TESTPOOL}-$id ; then
|
||||||
(( id = id + 1 ))
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if (( id == 0 )); then
|
|
||||||
log_must zpool export ${TESTPOOL}-$id
|
|
||||||
|
|
||||||
[[ -d /${TESTPOOL}-$id ]] && \
|
|
||||||
log_must rm -rf /${TESTPOOL}-$id
|
|
||||||
|
|
||||||
log_must zpool import -f ${TESTPOOL}-$id $TESTPOOL
|
|
||||||
|
|
||||||
[[ -e $TESTDIR/$TESTFILE0 ]] && \
|
|
||||||
log_must rm -rf $TESTDIR/$TESTFILE0
|
|
||||||
else
|
|
||||||
cleanup_filesystem "${TESTPOOL}-$id" $TESTFS
|
cleanup_filesystem "${TESTPOOL}-$id" $TESTFS
|
||||||
|
|
||||||
destroy_pool ${TESTPOOL}-$id
|
destroy_pool ${TESTPOOL}-$id
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(( id = id + 1 ))
|
(( id = id + 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -118,21 +99,12 @@ function cleanup_all
|
|||||||
function checksum_all #alter_root
|
function checksum_all #alter_root
|
||||||
{
|
{
|
||||||
typeset alter_root=$1
|
typeset alter_root=$1
|
||||||
typeset -i id=0
|
typeset -i id=1
|
||||||
typeset file
|
typeset file
|
||||||
typeset checksum2
|
typeset checksum2
|
||||||
|
|
||||||
while (( id < number )); do
|
while (( id < number )); do
|
||||||
if (( id == $PRIMARY_SLICE )); then
|
file=${alter_root}/$TESTDIR.$id/$TESTFILE0
|
||||||
(( id = id + 1 ))
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if (( id == 0 )); then
|
|
||||||
file=${alter_root}/$TESTDIR/$TESTFILE0
|
|
||||||
else
|
|
||||||
file=${alter_root}/$TESTDIR.$id/$TESTFILE0
|
|
||||||
fi
|
|
||||||
[[ ! -e $file ]] && \
|
[[ ! -e $file ]] && \
|
||||||
log_fail "$file missing after import."
|
log_fail "$file missing after import."
|
||||||
|
|
||||||
@ -148,35 +120,10 @@ function checksum_all #alter_root
|
|||||||
|
|
||||||
|
|
||||||
log_assert "Verify that 'zpool import -a' succeeds as root."
|
log_assert "Verify that 'zpool import -a' succeeds as root."
|
||||||
|
|
||||||
log_onexit cleanup_all
|
log_onexit cleanup_all
|
||||||
|
|
||||||
checksum1=$(sum $MYTESTFILE | awk '{print $1}')
|
checksum1=$(sum $MYTESTFILE | awk '{print $1}')
|
||||||
|
|
||||||
log_must zpool export $TESTPOOL
|
|
||||||
log_must zpool import $TESTPOOL ${TESTPOOL}-0
|
|
||||||
log_must cp $MYTESTFILE $TESTDIR/$TESTFILE0
|
|
||||||
log_must zpool export ${TESTPOOL}-0
|
|
||||||
[[ -d /${TESTPOOL}-0 ]] && \
|
|
||||||
log_must rm -rf /${TESTPOOL}-0
|
|
||||||
|
|
||||||
#
|
|
||||||
# setup exported pools on normal devices
|
|
||||||
#
|
|
||||||
number=1
|
number=1
|
||||||
while (( number <= $GROUP_NUM )); do
|
|
||||||
if (( number == $PRIMARY_SLICE)); then
|
|
||||||
(( number = number + 1 ))
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
setup_single_disk "${ZFS_DISK1}${SLICE_PREFIX}${number}" \
|
|
||||||
"${TESTPOOL}-$number" \
|
|
||||||
"$TESTFS" \
|
|
||||||
"$TESTDIR.$number"
|
|
||||||
|
|
||||||
(( number = number + 1 ))
|
|
||||||
done
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# setup exported pools on raw files
|
# setup exported pools on raw files
|
||||||
@ -194,7 +141,7 @@ done
|
|||||||
|
|
||||||
while (( i < ${#options[*]} )); do
|
while (( i < ${#options[*]} )); do
|
||||||
|
|
||||||
log_must zpool import -d ${DEV_DSKDIR} -d $DEVICE_DIR ${options[i]} -a -f
|
log_must zpool import -d $DEVICE_DIR ${options[i]} -a -f
|
||||||
|
|
||||||
# destroy unintentional imported pools
|
# destroy unintentional imported pools
|
||||||
typeset exclude=`eval echo \"'(${KEEP})'\"`
|
typeset exclude=`eval echo \"'(${KEEP})'\"`
|
||||||
@ -209,7 +156,7 @@ while (( i < ${#options[*]} )); do
|
|||||||
checksum_all
|
checksum_all
|
||||||
fi
|
fi
|
||||||
|
|
||||||
id=0
|
id=1
|
||||||
while (( id < number )); do
|
while (( id < number )); do
|
||||||
if poolexists ${TESTPOOL}-$id ; then
|
if poolexists ${TESTPOOL}-$id ; then
|
||||||
log_must zpool export ${TESTPOOL}-$id
|
log_must zpool export ${TESTPOOL}-$id
|
||||||
|
Loading…
Reference in New Issue
Block a user