mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
zdb and inuse tests don't pass with real disks
Due to zpool create auto-partioning in Linux (i.e. sdb1), certain utilities need to use the parition (sdb1) while others use the whole disk name (sdb). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Paul Zuchowski <pzuchowski@datto.com> Closes #6939 Closes #7261
This commit is contained in:
committed by
Brian Behlendorf
parent
0e85048f53
commit
8e5d14844d
@@ -423,3 +423,19 @@ function get_debug_device
|
||||
{
|
||||
lsscsi | nawk '/scsi_debug/ {print $6; exit}' | cut -d / -f3
|
||||
}
|
||||
|
||||
#
|
||||
# Get actual devices used by the pool (i.e. linux sdb1 not sdb).
|
||||
#
|
||||
function get_pool_devices #testpool #devdir
|
||||
{
|
||||
typeset testpool=$1
|
||||
typeset devdir=$2
|
||||
typeset out=""
|
||||
|
||||
if is_linux; then
|
||||
out=$(zpool status -P $testpool |grep ${devdir} | awk '{print $1}')
|
||||
out=$(echo $out | sed -e "s|${devdir}/||g" | tr '\n' ' ')
|
||||
fi
|
||||
echo $out
|
||||
}
|
||||
|
||||
@@ -806,7 +806,11 @@ function zero_partitions #<whole_disk_name>
|
||||
typeset i
|
||||
|
||||
if is_linux; then
|
||||
log_must parted $DEV_DSKDIR/$diskname -s -- mklabel gpt
|
||||
DSK=$DEV_DSKDIR/$diskname
|
||||
DSK=$(echo $DSK | sed -e "s|//|/|g")
|
||||
log_must parted $DSK -s -- mklabel gpt
|
||||
blockdev --rereadpt $DSK 2>/dev/null
|
||||
block_device_wait
|
||||
else
|
||||
for i in 0 1 3 4 5 6 7
|
||||
do
|
||||
@@ -834,10 +838,11 @@ function set_partition #<slice_num> <slice_start> <size_plus_units> <whole_disk
|
||||
typeset start=$2
|
||||
typeset size=$3
|
||||
typeset disk=$4
|
||||
[[ -z $slicenum || -z $size || -z $disk ]] && \
|
||||
log_fail "The slice, size or disk name is unspecified."
|
||||
|
||||
if is_linux; then
|
||||
if [[ -z $size || -z $disk ]]; then
|
||||
log_fail "The size or disk name is unspecified."
|
||||
fi
|
||||
typeset size_mb=${size%%[mMgG]}
|
||||
|
||||
size_mb=${size_mb%%[mMgG][bB]}
|
||||
@@ -880,6 +885,10 @@ function set_partition #<slice_num> <slice_start> <size_plus_units> <whole_disk
|
||||
blockdev --rereadpt $DEV_DSKDIR/$disk 2>/dev/null
|
||||
block_device_wait
|
||||
else
|
||||
if [[ -z $slicenum || -z $size || -z $disk ]]; then
|
||||
log_fail "The slice, size or disk name is unspecified."
|
||||
fi
|
||||
|
||||
typeset format_file=/var/tmp/format_in.$$
|
||||
|
||||
echo "partition" >$format_file
|
||||
|
||||
Reference in New Issue
Block a user