test/vhost: fix parted error

Vhost nightly test fails on Error: Partition have been written, but
we have been unable to inform the kernel of the change, probably
because it/they are in use.

Closes #1090

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: Iafd051e02b3dd32ede8a62c69c7079a0facade0c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476639
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Maciej Wawryk 2019-12-03 15:54:38 +01:00 committed by Tomasz Zawadzki
parent aac65dcfd8
commit a291cb0606

View File

@ -20,12 +20,17 @@ trap "exit 1" SIGINT SIGTERM EXIT
for fs in $fs; do
for dev in $devs; do
i=0
parted_cmd="parted -s /dev/${dev}"
echo "INFO: Creating partition table on disk using: $parted_cmd mklabel gpt"
$parted_cmd mklabel gpt
while ! ($parted_cmd print | grep -q gpt); do
[[ $i -lt 100 ]] || break
i=$((i+1))
sleep 0.1
done
$parted_cmd mkpart primary 2048s 100%
sleep 2
mkfs_cmd="mkfs.$fs"
if [[ $fs == "ntfs" ]]; then
@ -33,7 +38,13 @@ for fs in $fs; do
fi
mkfs_cmd+=" /dev/${dev}1"
echo "INFO: Creating filesystem using: $mkfs_cmd"
wipefs -a /dev/${dev}1
i=0
until wipefs -a /dev/${dev}1; do
[[ $i -lt 100 ]] || break
i=$((i+1))
echo "Waiting for /dev/${dev}1"
sleep 0.1
done
$mkfs_cmd
mkdir -p /mnt/${dev}dir
@ -51,6 +62,7 @@ for fs in $fs; do
for dev in $devs; do
umount /mnt/${dev}dir
rm -rf /mnt/${dev}dir
parted -s /dev/${dev} rm 1
stats=( $(cat /sys/block/$dev/stat) )
echo ""