ZTS: Cleanup partition tables

The cleanup_devices function should remove any partitions created
on the device and force the partition table to be reread.  This
is needed to ensure that blkid has an up to date version of what
devices and partitions are used by zfs.

The cleanup_devices call was removed from inuse_008_pos.ksh since
it operated on partitions instead of devices and was not needed.

Lastly ddidecode may be called by parted and was therefore added
to the constrained path.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #9806
This commit is contained in:
Brian Behlendorf 2020-01-06 11:14:19 -08:00 committed by Tony Hutter
parent 0a37abc206
commit 82be309780
3 changed files with 5 additions and 4 deletions

View File

@ -33,6 +33,7 @@ export SYSTEM_FILES='arp
diff
dirname
dmesg
dmidecode
du
echo
egrep

View File

@ -2202,10 +2202,11 @@ function cleanup_devices #vdevs
{
typeset pool="foopool$$"
if poolexists $pool ; then
destroy_pool $pool
fi
for vdev in $@; do
zero_partitions $vdev
done
poolexists $pool && destroy_pool $pool
create_pool $pool $@
destroy_pool $pool

View File

@ -107,7 +107,6 @@ while (( i < ${#vdevs[*]} )); do
create_pool $TESTPOOL1 ${vdevs[i]} $vslices spare $sslices
log_must zpool export $TESTPOOL1
verify_assertion "$rawtargets"
cleanup_devices $vslices $sslices
(( i = i + 1 ))
done