main - tests: check fsadm with missing filesystem
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2151b71819ffd45e71f...
Commit: 2151b71819ffd45e71f2565aa2c0d2cb9685e2c0
Parent: 28865f971e0b23f4d1a4117e0e0fdb61bd21d836
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 24 16:33:16 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 24 16:38:12 2021 +0100
tests: check fsadm with missing filesystem
---
test/shell/fsadm.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/test/shell/fsadm.sh b/test/shell/fsadm.sh
index 987b1a1a9..c5b3774c2 100644
--- a/test/shell/fsadm.sh
+++ b/test/shell/fsadm.sh
@@ -99,6 +99,10 @@ fsadm
# check needs arg
not fsadm check
+# check needs arg
+not fsadm resize "$dev_vg_lv" 30M |& tee out
+grep "Cannot get FSTYPE" out
+
if check_missing ext2; then
mkfs.ext2 -b4096 -j "$dev_vg_lv"
3 years, 1 month
main - fsadm: handle error from blkid
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=28865f971e0b23f4d1a...
Commit: 28865f971e0b23f4d1a4117e0e0fdb61bd21d836
Parent: 63c58d2a5d935cd78c77f3db13a655e68fb36367
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 24 16:26:17 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 24 16:37:09 2021 +0100
fsadm: handle error from blkid
Fsadm wants to print its own error message when it can't detect
type of the filesystem on a block device.
Otherwise fsadm exits with no message on an unused block device.
---
scripts/fsadm.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index 20ae57462..3e1f3d405 100755
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -230,7 +230,7 @@ detect_fs() {
esac
# use null device as cache file to be sure about the result
# not using option '-o value' to be compatible with older version of blkid
- FSTYPE=$("$BLKID" -c "$NULL" -s TYPE "$VOLUME")
+ FSTYPE=$("$BLKID" -c "$NULL" -s TYPE "$VOLUME" || true)
test -n "$FSTYPE" || error "Cannot get FSTYPE of \"$VOLUME\"."
FSTYPE=${FSTYPE##*TYPE=\"} # cut quotation marks
FSTYPE=${FSTYPE%%\"*}
3 years, 1 month
main - fsadm: fix condition when using --getsize64
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=63c58d2a5d935cd78c7...
Commit: 63c58d2a5d935cd78c77f3db13a655e68fb36367
Parent: 9684e82cc44cfec66f30b807160c19c06df2a2d8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 24 16:11:55 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 24 16:34:34 2021 +0100
fsadm: fix condition when using --getsize64
When blocksize --getsize64 gives empty result we want to fallback
to ancient --getsize * --getss calculation (RHBZ #1942486).
Reported by: ajschorr(a)alumni.princeton.edu
---
scripts/fsadm.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index d98833c3a..20ae57462 100755
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -378,7 +378,7 @@ detect_mounted() {
detect_device_size() {
# check if blockdev supports getsize64
DEVSIZE=$("$BLOCKDEV" --getsize64 "$VOLUME" 2>"$NULL" || true)
- if test -n "$DEVSIZE" ; then
+ if test -z "$DEVSIZE" ; then
DEVSIZE=$("$BLOCKDEV" --getsize "$VOLUME" || true)
test -n "$DEVSIZE" || error "Cannot read size of device \"$VOLUME\"."
SSSIZE=$("$BLOCKDEV" --getss "$VOLUME" || true)
3 years, 1 month
main - tests: ignore incosistent raid status
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9684e82cc44cfec66f3...
Commit: 9684e82cc44cfec66f30b807160c19c06df2a2d8
Parent: afd43a75f20fbecb047924468c84212f7aefcf0b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 24 12:08:40 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 24 12:40:17 2021 +0100
tests: ignore incosistent raid status
Just like lvm command ignores 0/xxxx report from judging the status.
Avoid using infinite loop and limit report checking to 100 checks.
If it would need more - something is not right.
---
test/shell/lvconvert-raid-status-validation.sh | 51 ++++++++++++++++----------
1 file changed, 31 insertions(+), 20 deletions(-)
diff --git a/test/shell/lvconvert-raid-status-validation.sh b/test/shell/lvconvert-raid-status-validation.sh
index 2d3b5b982..d923bf543 100644
--- a/test/shell/lvconvert-raid-status-validation.sh
+++ b/test/shell/lvconvert-raid-status-validation.sh
@@ -36,25 +36,28 @@ vgcreate $SHARED -s 2m "$vg" "${DEVICES[@]}"
###########################################
# Upconverted RAID1 should never have all 'a's in status output
###########################################
-aux delay_dev "$dev2" 0 50
+aux delay_dev "$dev2" 0 20
lvcreate -aey -l 2 -n $lv1 $vg "$dev1"
lvconvert --type raid1 -y -m 1 $vg/$lv1 "$dev2"
-while ! check in_sync $vg $lv1; do
- a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1"
+for i in {100..0}; do
+ check in_sync $vg $lv1 && break
+ a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1"
b=( $(echo "${a[6]}" | sed s:/:' ':) )
if [ "${b[0]}" -ne "${b[1]}" ]; then
# First, 'check in_sync' should only need to check the ratio
# If we are here, it is probably doing more than that.
# If not in-sync, then we should only ever see "Aa"
- [ "${a[5]}" == "Aa" ]
+ # Ignore until raid starts to report consistent data
+ [ "${b[0]}" = "0" ] || [ "${a[5]}" == "Aa" ]
else
[ "${a[5]}" != "aa" ]
should [ "${a[5]}" == "AA" ] # RHBZ 1507719
fi
- sleep .1
+ sleep .1
done
aux enable_dev "$dev2"
lvremove -ff $vg
+test "$i" -gt 0 || die "Unable to get in sync $vg/$lv1"
###########################################
# Upconverted RAID1 should not be at 100% right after upconvert
@@ -71,13 +74,15 @@ lvremove -ff $vg
###########################################
# Catch anything suspicious with linear -> RAID1 upconvert
###########################################
-aux delay_dev "$dev2" 0 50
+aux delay_dev "$dev2" 0 20
lvcreate -aey -l 2 -n $lv1 $vg "$dev1"
lvconvert --type raid1 -y -m 1 $vg/$lv1 "$dev2"
-while true; do
- a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1"
+for i in {100..0}; do
+ a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1"
b=( $(echo "${a[6]}" | sed s:/:' ':) )
- if [ "${b[0]}" -ne "${b[1]}" ]; then
+ if [ "${b[0]}" -eq "0" ]; then
+ : # Ignore until raid starts to report consistent data
+ elif [ "${b[0]}" -ne "${b[1]}" ]; then
# If the sync operation ("recover" in this case) is not
# finished, then it better be as follows:
[ "${a[5]}" = "Aa" ]
@@ -96,7 +101,7 @@ while true; do
should [ "${a[7]}" = "idle" ] # RHBZ 1507719
break
fi
- sleep .1
+ sleep .1
done
aux enable_dev "$dev2"
lvremove -ff $vg
@@ -104,14 +109,16 @@ lvremove -ff $vg
###########################################
# Catch anything suspicious with RAID1 2-way -> 3-way upconvert
###########################################
-aux delay_dev "$dev3" 0 50
+aux delay_dev "$dev3" 0 20
lvcreate --type raid1 -m 1 -aey -l 2 -n $lv1 $vg "$dev1" "$dev2"
aux wait_for_sync $vg $lv1
lvconvert -y -m +1 $vg/$lv1 "$dev3"
-while true; do
- a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1"
+for i in {100..0}; do
+ a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1"
b=( $(echo "${a[6]}" | sed s:/:' ':) )
- if [ "${b[0]}" -ne "${b[1]}" ]; then
+ if [ "${b[0]}" -eq "0" ]; then
+ : # Ignore until raid starts to report consistent data
+ elif [ "${b[0]}" -ne "${b[1]}" ]; then
# If the sync operation ("recover" in this case) is not
# finished, then it better be as follows:
[ "${a[5]}" = "AAa" ]
@@ -125,20 +132,23 @@ while true; do
should [ "${a[7]}" = "idle" ] # RHBZ 1507719
break
fi
- sleep .1
+ sleep .1
done
aux enable_dev "$dev3"
lvremove -ff $vg
+test "$i" -gt 0 || die "Unable to get in sync $vg/$lv1"
###########################################
# Catch anything suspicious with RAID1 initial resync
###########################################
-aux delay_dev "$dev2" 0 50
+aux delay_dev "$dev2" 0 20
lvcreate --type raid1 -m 1 -aey -l 2 -n $lv1 $vg "$dev1" "$dev2"
-while true; do
- a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1"
+for i in {100..0}; do
+ a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1"
b=( $(echo "${a[6]}" | sed s:/:' ':) )
- if [ "${b[0]}" -ne "${b[1]}" ]; then
+ if [ "${b[0]}" -eq "0" ]; then
+ : # Ignore until raid starts to report consistent data
+ elif [ "${b[0]}" -ne "${b[1]}" ]; then
# If the sync operation ("resync" in this case) is not
# finished, then it better be as follows:
[ "${a[5]}" = "aa" ]
@@ -153,9 +163,10 @@ while true; do
should [ "${a[7]}" = "idle" ] # RHBZ 1507719
break
fi
- sleep .1
+ sleep .1
done
aux enable_dev "$dev2"
lvremove -ff $vg
+test "$i" -gt 0 || die "Unable to get in sync $vg/$lv1"
vgremove -ff $vg
3 years, 1 month
main - tests: skip stray testing on real dev dir
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=afd43a75f20fbecb047...
Commit: afd43a75f20fbecb047924468c84212f7aefcf0b
Parent: a126dde069ada9380ba2f7ab7e520ba4ce3e2a90
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 24 11:57:46 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 24 12:23:07 2021 +0100
tests: skip stray testing on real dev dir
Do not modify /dev dir maintained by udev.
---
test/shell/stray-device-node.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/test/shell/stray-device-node.sh b/test/shell/stray-device-node.sh
index 7ed229388..003afb7e8 100644
--- a/test/shell/stray-device-node.sh
+++ b/test/shell/stray-device-node.sh
@@ -18,6 +18,9 @@ SKIP_WITH_LVMPOLLD=1
aux prepare_devs 3
get_devs
+# Avoid manipulation with real /dev dir
+test "$DM_DEV_DIR" = "/dev" && skip "Skipping stray test on real /dev dir"
+
cp -r "$dev1" "$DM_DEV_DIR/stray"
vgcreate $SHARED "$vg" "${DEVICES[@]}"
@@ -29,3 +32,5 @@ aux disable_dev "$dev1"
pvscan
vgreduce --removemissing --force $vg
aux enable_dev "$dev1"
+
+rm -f "$DM_DEV_DIR/stray"
3 years, 1 month
main - tests: remove more file in teardonw
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a126dde069ada9380ba...
Commit: a126dde069ada9380ba2f7ab7e520ba4ce3e2a90
Parent: 18f2475fa18bfe8b08af830bb8335d41928206fe
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 24 00:39:01 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 24 12:23:07 2021 +0100
tests: remove more file in teardonw
Our tests may result in producation of huge set of
invalid links in /dev/disk directory depeding on version
of udev and various kinds of failures.
Also we happen to invoke some on-system pvscans generating
local /etc/lvm/archive & backups - remove them when
test is finished.
---
test/lib/aux.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 08eeac55b..f81d03e88 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -580,6 +580,12 @@ teardown() {
rm -rf "${TESTDIR:?}" || echo BLA
}
+ # Remove any dangling symlink in /dev/disk (our tests can confuse udev)
+ find /dev/disk -type l ! -exec test -e {} \; -print | xargs rm -f
+
+ # Remove any metadata archives and backups from this test on system
+ rm -f /etc/lvm/archive/${PREFIX}* /etc/lvm/backup/${PREFIX}*
+
echo "ok"
}
3 years, 1 month
main - tests: query info instead of table
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=18f2475fa18bfe8b08a...
Commit: 18f2475fa18bfe8b08af830bb8335d41928206fe
Parent: 8df0a32abb840815c5d210cbdbd1483d483ee729
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 24 00:37:24 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 24 12:22:27 2021 +0100
tests: query info instead of table
No need to access table when we just check presence,
so generate smaller error message about missing device.
---
test/shell/lvm-on-md.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/test/shell/lvm-on-md.sh b/test/shell/lvm-on-md.sh
index 22d5b4ca4..9187d44f5 100644
--- a/test/shell/lvm-on-md.sh
+++ b/test/shell/lvm-on-md.sh
@@ -93,7 +93,7 @@ not grep "Not using device" out
not vgchange -ay $vg
# should not show an active lv
-not dmsetup table $vg-$lv1
+not dmsetup info $vg-$lv1
# should not allow updating vg
not lvcreate -l1 $vg
@@ -107,7 +107,7 @@ test ! -f "$RUNDIR/lvm/pvs_online/$PVIDMD"
test ! -f "$RUNDIR/lvm/vgs_online/$vg"
# should not show an active lv
-not dmsetup table $vg-$lv1
+not dmsetup info $vg-$lv1
mdadm --assemble "$mddev" "$dev1" "$dev2"
aux udev_wait
@@ -130,7 +130,7 @@ test ! -f "$RUNDIR/lvm/pvs_online/$PVIDMD"
test ! -f "$RUNDIR/lvm/vgs_online/$vg"
# should not show an active lv
-not dmsetup table $vg-$lv1
+not dmsetup info $vg-$lv1
vgchange -ay $vg
@@ -247,7 +247,7 @@ grep "$dev3" out
not vgchange -ay $vg
# should not show an active lv
-not dmsetup table $vg-$lv1
+not dmsetup info $vg-$lv1
# should not allow updating vg
not lvcreate -l1 $vg
@@ -261,7 +261,7 @@ test ! -f "$RUNDIR/lvm/pvs_online/$PVIDMD"
test ! -f "$RUNDIR/lvm/vgs_online/$vg"
# should not show an active lv
-not dmsetup table $vg-$lv1
+not dmsetup info $vg-$lv1
# start the md dev
mdadm --assemble "$mddev" "$dev1" "$dev2"
@@ -285,7 +285,7 @@ test ! -f "$RUNDIR/lvm/pvs_online/$PVIDMD"
test ! -f "$RUNDIR/lvm/vgs_online/$vg"
# should not show an active lv
-not dmsetup table $vg-$lv1
+not dmsetup info $vg-$lv1
vgchange -ay $vg
3 years, 1 month
main - tests: this test has race in it depending on kernel
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8df0a32abb840815c5d...
Commit: 8df0a32abb840815c5d210cbdbd1483d483ee729
Parent: dd1f5f9a24fc906de7e6dd064ecdd8fdfa9eebda
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 23 21:32:51 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 23 21:32:51 2021 +0100
tests: this test has race in it depending on kernel
Some kernel seems to keep 'lvextend' busy so long,
that actual resize already happens.
So ATM use 'should' until something better is invented.
---
test/shell/lvextend-raid.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/shell/lvextend-raid.sh b/test/shell/lvextend-raid.sh
index 9370bf295..08b34d00c 100644
--- a/test/shell/lvextend-raid.sh
+++ b/test/shell/lvextend-raid.sh
@@ -63,7 +63,8 @@ aux delayzero_dev "$dev2" 0 50 "${sector}:"
lvextend -y -L+${lvext}M $vg/$lv1
if [ $PROGRESS -eq 1 ]
then
-not check lv_field $vg/$lv1 sync_percent "100.00"
+# Even with delayed devices wre are catching races here.
+should not check lv_field $vg/$lv1 sync_percent "100.00"
check lv_field $vg/$lv1 size "$(($lvsz)).00m" $vg/$lv1
fi
aux wait_for_sync $vg $lv1
3 years, 1 month
main - tests: aux clean DM on top of MD
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=dd1f5f9a24fc906de7e...
Commit: dd1f5f9a24fc906de7e6dd064ecdd8fdfa9eebda
Parent: 93f2d194aca4a589cd38dd8bdd99cad2945dd21c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 23 21:28:28 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 23 21:28:28 2021 +0100
tests: aux clean DM on top of MD
Before cleaning MD, try to remove any DM on top such MD.
Check is made through DM table check.
Maybe parse /proc/mdstat for this???
---
test/lib/aux.sh | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 386918041..08eeac55b 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -783,11 +783,21 @@ cleanup_md_dev() {
mddev=$(< MD_DEV)
base=$(basename "$mddev")
+ # try to find and remove any DM device on top of cleaned MD
+ # assume /dev/mdXXX is 9:MINOR
+ local minor=${mddev##/dev/md}
+ for i in $(dmsetup table | grep 9:$minor | cut -d: -f1) ; do
+ dmsetup remove $i || {
+ dmsetup --force remove $i || true
+ }
+ done
+
for i in {0..10} ; do
grep -q "$base" /proc/mdstat || break
test "$i" = 0 || {
sleep .1
echo "$mddev is still present, stopping again"
+ cat /proc/mdstat
}
mdadm --stop "$mddev" || true
udev_wait # wait till events are process, not zeroing to early
3 years, 1 month
main - tests: wipefs with udev_wait
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=93f2d194aca4a589cd3...
Commit: 93f2d194aca4a589cd38dd8bdd99cad2945dd21c
Parent: 14a3c34983fa8ab99773a47f1ee8bdd02d84feef
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 23 14:57:10 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 23 14:57:10 2021 +0100
tests: wipefs with udev_wait
Try to synchronize with colliding udev.
Also retry once if there is some failure with some
sleep between next retry.
Use oflag=direct for wipping without wipefs.
---
test/lib/aux.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 20736260f..386918041 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -818,10 +818,16 @@ wipefs_a() {
echo "$have_wipefs" > HAVE_WIPEFS
fi
+ udev_wait
if [ "$have_wipefs" = "1" ] ; then
- wipefs -a "$dev"
+ wipefs -a "$dev" || {
+ echo "$dev: device in-use, retrying wipe again."
+ sleep 1
+ udev_wait
+ wipefs -a "$dev"
+ }
else
- dd if=/dev/zero of="$dev" bs=4096 count=8 >/dev/null || true
+ dd if=/dev/zero of="$dev" bs=4096 count=8 oflag=direct >/dev/null || true
mdadm --zero-superblock "$dev" 2>/dev/null || true
fi
3 years, 1 month