From 726cf41b80acb379ff69f476bb3b88df0db937d0 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Thu, 23 Feb 2012 23:58:42 +0000 Subject: [PATCH] Make the calls to pvscan --lvmetad in the testsuite slightly more civilised. --- test/lib/aux.sh | 10 ++++++++-- test/shell/lvcreate-repair.sh | 2 +- test/shell/pool-labels.sh | 2 +- test/shell/vgimportclone.sh | 6 +++--- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/test/lib/aux.sh b/test/lib/aux.sh index 9bc7d0fba..4ae596ddc 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -78,6 +78,12 @@ prepare_lvmetad() { sleep 1 } +notify_lvmetad() { + if test -e LOCAL_LVMETAD; then + pvscan --lvmetad "$@" || true + fi +} + teardown_devs() { # Delete any remaining dm/udev semaphores teardown_udev_cookies @@ -328,7 +334,7 @@ disable_dev() { min=$(($(stat --printf=0x%T $dev))) echo "disabling device $dev ($maj:$min)" dmsetup remove -f $dev || true - pvscan --lvmetad $maj:$min || true + notify_lvmetad $maj:$min done finish_udev_transaction @@ -342,7 +348,7 @@ enable_dev() { dmsetup create -u TEST-$name $name $name.table || dmsetup load $name $name.table # using device name (since device path does not exists yes with udev) dmsetup resume $name - pvscan --lvmetad $dev || true + notify_lvmetad $dev done finish_udev_transaction } diff --git a/test/shell/lvcreate-repair.sh b/test/shell/lvcreate-repair.sh index 12da518cb..f1028e91e 100644 --- a/test/shell/lvcreate-repair.sh +++ b/test/shell/lvcreate-repair.sh @@ -86,7 +86,7 @@ dd if=backup_i of="$dev1" bs=256K count=1 # dirty game dd if=/dev/zero of="$dev3" bs=256K count=1 -pvscan --lvmetad $dev3 || true # udev be watching you +aux notify_lvmetad $dev3 # udev be watching you vgreduce --removemissing --force $vg diff --git a/test/shell/pool-labels.sh b/test/shell/pool-labels.sh index b4590f02e..c3cbda967 100644 --- a/test/shell/pool-labels.sh +++ b/test/shell/pool-labels.sh @@ -18,7 +18,7 @@ create_pool_label_() # printf comes from coreutils, and is probably not posix either env printf "\x01\x16\x70\x06\x5f\xcf\xff\xb9\xf8\x24\x8apool1" | dd of=$2 bs=5 seek=1 conv=notrunc env printf "\x04\x01\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x0$1\x68\x01\x16\x70\x00\x00\x00\x00\x00\x06\x5f\xd0" | dd of=$2 bs=273 seek=1 conv=notrunc - pvscan --lvmetad "$2" || true + aux notify_lvmetad "$2" } env printf "" || exit 200 # skip if printf is not available diff --git a/test/shell/vgimportclone.sh b/test/shell/vgimportclone.sh index 94296986d..9a4a32dcb 100644 --- a/test/shell/vgimportclone.sh +++ b/test/shell/vgimportclone.sh @@ -17,7 +17,7 @@ lvcreate -l100%FREE -n $lv1 $vg1 # Clone the LUN dd if=$dev1 of=$dev2 bs=256K count=1 -pvscan --lvmetad $dev2 || true +aux notify_lvmetad $dev2 # Verify pvs works on each device to give us vgname check pv_field $dev1 vg_name $vg1 @@ -30,8 +30,8 @@ vgimportclone --basevgname $vg2 $dev2 # concerned, can only live on a single device. With the last pvscan, we told it # that PV from $dev1 now lives on $dev2, but in fact this is not true anymore, # since we wrote a different PV over $dev2. -pvscan --lvmetad $dev2 || true -pvscan --lvmetad $dev1 || true +aux notify_lvmetad $dev2 +aux notify_lvmetad $dev1 # Verify we can activate / deactivate the LV from both VGs lvchange -ay $vg1/$lv1 $vg2/$lv1