1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

shellcheck: warning enhancements

This commit is contained in:
Zdenek Kabelac 2021-09-21 18:02:50 +02:00
parent 5bd99d55b0
commit bb6fd1a15f
11 changed files with 31 additions and 31 deletions

View File

@ -262,7 +262,7 @@ convert2lvm_() {
if [ -z "$VGNAME" ] || [ "$VGNAME" = "$LVNAME" ] ; then if [ -z "$VGNAME" ] || [ "$VGNAME" = "$LVNAME" ] ; then
VGNAME=${DEFAULT_NAME%/*} VGNAME=${DEFAULT_NAME%/*}
# Find largest matching VG name to our 'default' vgname # Find largest matching VG name to our 'default' vgname
LASTVGNAME=$(LC_ALL=C "$LVM" vgs -oname -O-name --noheadings -S name=~${VGNAME} | grep -E "$VGNAME[0-9]? ?" | head -1 || true) LASTVGNAME=$(LC_ALL=C "$LVM" vgs -oname -O-name --noheadings -S name=~${VGNAME} | grep -E "${VGNAME}[0-9]? ?" | head -1 || true)
if test -n "$LASTVGNAME" ; then if test -n "$LASTVGNAME" ; then
LASTVGNAME=${LASTVGNAME#*${VGNAME}} LASTVGNAME=${LASTVGNAME#*${VGNAME}}
# If the number is becoming too high, try some random number # If the number is becoming too high, try some random number

View File

@ -607,7 +607,7 @@ teardown() {
# Remove any dangling symlink in /dev/disk (our tests can confuse udev) # Remove any dangling symlink in /dev/disk (our tests can confuse udev)
test -d /dev/disk && { test -d /dev/disk && {
find /dev/disk -type l ! -exec /usr/bin/test -e {} \; -print | xargs rm -f || true find /dev/disk -type l ! -exec /usr/bin/test -e {} \; -print0 | xargs -0 rm -f || true
} }
# Remove any metadata archives and backups from this test on system # Remove any metadata archives and backups from this test on system
@ -1200,7 +1200,7 @@ remove_dm_devs() {
} }
remove=( "${held[@]}" ) remove=( "${held[@]}" )
done done
die "Can't remove device(s) ${held[@]}" die "Can't remove device(s) ${held[*]}"
} }
# Throttle down performance of kcopyd when mirroring i.e. disk image # Throttle down performance of kcopyd when mirroring i.e. disk image

View File

@ -476,9 +476,9 @@ cat "$DF"
# pvscan does not fix DF # pvscan does not fix DF
grep "$dev3" "$DF" grep "$dev3" "$DF"
not grep "$dev1" "$DF" not grep "$dev1" "$DF"
ls "$RUNDIR/lvm/pvs_online/"$PVID1"" ls "$RUNDIR/lvm/pvs_online/$PVID1"
ls "$RUNDIR/lvm/pvs_online/$PVID2" ls "$RUNDIR/lvm/pvs_online/$PVID2"
not ls "$RUNDIR/lvm/pvs_online/"$PVID3"" not ls "$RUNDIR/lvm/pvs_online/$PVID3"
check lv_field $vg1/$lv1 lv_active "active" check lv_field $vg1/$lv1 lv_active "active"
# pvs updates the DF # pvs updates the DF
pvs |tee out pvs |tee out

View File

@ -122,7 +122,7 @@ cp $DF df2
# vgcreate from existing pvs, already in df # vgcreate from existing pvs, already in df
vgcreate $vg ${REAL_DEVICES[@]} vgcreate $vg "${REAL_DEVICES[@]}"
vgremove $vg vgremove $vg
rm $DF rm $DF
@ -130,7 +130,7 @@ rm $DF
# vgcreate from existing pvs, adding to df # vgcreate from existing pvs, adding to df
touch $DF touch $DF
vgcreate $vg ${REAL_DEVICES[@]} vgcreate $vg "${REAL_DEVICES[@]}"
grep IDNAME $DF > df.ids grep IDNAME $DF > df.ids
grep IDNAME df2 > df2.ids grep IDNAME df2 > df2.ids
@ -242,7 +242,7 @@ grep $dev2 $DF
rm $DF rm $DF
wipe_all wipe_all
vgcreate $vg ${REAL_DEVICES[@]} vgcreate $vg "${REAL_DEVICES[@]}"
rm $DF rm $DF
touch $DF touch $DF

View File

@ -14,7 +14,7 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest . lib/inittest
[ -z "$LVM_TEST_FAILURE" ] && skip; [ -z "$LVM_TEST_FAILURE" ] && skip
aux prepare_devs 3 aux prepare_devs 3
aux extend_filter_LVMTEST aux extend_filter_LVMTEST
@ -33,17 +33,17 @@ HOST2=`readlink /sys/block/$DRIVE2 | awk -F'/' '{print $6}'`
HOST3=`readlink /sys/block/$DRIVE3 | awk -F'/' '{print $6}'` HOST3=`readlink /sys/block/$DRIVE3 | awk -F'/' '{print $6}'`
# Emulate fabric failure # Emulate fabric failure
echo 1 > /sys/block/$DRIVE1/device/delete echo 1 > "/sys/block/$DRIVE1/device/delete"
[ -f /sys/block/$DRIVE2/device/delete ] && echo 1 > /sys/block/$DRIVE2/device/delete [ -f "/sys/block/$DRIVE2/device/delete" ] && echo 1 > "/sys/block/$DRIVE2/device/delete"
[ -f /sys/block/$DRIVE3/device/delete ] && echo 1 > /sys/block/$DRIVE3/device/delete [ -f "/sys/block/$DRIVE3/device/delete" ] && echo 1 > "/sys/block/$DRIVE3/device/delete"
# Wait for 10s and will not lead to timeout # Wait for 10s and will not lead to timeout
sleep 10 sleep 10
# Rescan drives so can probe the deleted drives and join back them # Rescan drives so can probe the deleted drives and join back them
echo "- - -" > /sys/class/scsi_host/${HOST1}/scan echo "- - -" > "/sys/class/scsi_host/${HOST1}/scan"
echo "- - -" > /sys/class/scsi_host/${HOST2}/scan echo "- - -" > "/sys/class/scsi_host/${HOST2}/scan"
echo "- - -" > /sys/class/scsi_host/${HOST3}/scan echo "- - -" > "/sys/class/scsi_host/${HOST3}/scan"
not check grep_lvmlockd_dump "S lvm_$vg kill_vg" not check grep_lvmlockd_dump "S lvm_$vg kill_vg"

View File

@ -15,8 +15,8 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest . lib/inittest
[ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip; [ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip
[ -z "$LVM_TEST_FAILURE" ] && skip; [ -z "$LVM_TEST_FAILURE" ] && skip
aux prepare_devs 2 aux prepare_devs 2
aux extend_filter_LVMTEST aux extend_filter_LVMTEST
@ -55,7 +55,7 @@ for dev in /dev/*; do
done done
for d in "${drive_list[@]}"; do for d in "${drive_list[@]}"; do
[ -f /sys/block/$d/device/delete ] && echo 1 > /sys/block/$d/device/delete [ -f "/sys/block/$d/device/delete" ] && echo 1 > "/sys/block/$d/device/delete"
done done
# Fail to create new logic volume # Fail to create new logic volume
@ -68,7 +68,7 @@ not check grep_lvmlockd_dump "S lvm_$vg kill_vg"
# Rescan drives so can probe the deleted drives and join back them # Rescan drives so can probe the deleted drives and join back them
for h in "${host_list[@]}"; do for h in "${host_list[@]}"; do
[ -f /sys/class/scsi_host/${h}/scan ] && echo "- - -" > /sys/class/scsi_host/${h}/scan [ -f "/sys/class/scsi_host/${h}/scan" ] && echo "- - -" > "/sys/class/scsi_host/${h}/scan"
done done
# After the drive is reconnected, $vg should be visible again. # After the drive is reconnected, $vg should be visible again.

View File

@ -15,8 +15,8 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest . lib/inittest
[ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip; [ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip
[ -z "$LVM_TEST_FAILURE" ] && skip; [ -z "$LVM_TEST_FAILURE" ] && skip
aux prepare_devs 1 aux prepare_devs 1
aux extend_filter_LVMTEST aux extend_filter_LVMTEST
@ -34,7 +34,7 @@ vgcreate $SHARED $vg "$dev1"
# Create new logic volume # Create new logic volume
lvcreate -a ey --zero n -l 1 -n $lv1 $vg lvcreate -a ey --zero n -l 1 -n $lv1 $vg
drive_list=($DRIVE1) drive_list=( "$DRIVE1" )
# Find all drives with the same WWN and delete them from system, # Find all drives with the same WWN and delete them from system,
# so that we can emulate the same drive with multiple paths are # so that we can emulate the same drive with multiple paths are
@ -52,7 +52,7 @@ for dev in /dev/*; do
done done
for d in "${drive_list[@]}"; do for d in "${drive_list[@]}"; do
[ -f /sys/block/$d/device/delete ] && echo 1 > /sys/block/$d/device/delete [ -f "/sys/block/$d/device/delete" ] && echo 1 > "/sys/block/$d/device/delete"
done done
# Fail to create new logic volume # Fail to create new logic volume
@ -66,7 +66,7 @@ lvmlockctl --drop $vg
# Rescan drives so can probe the deleted drives and join back them # Rescan drives so can probe the deleted drives and join back them
for h in "${host_list[@]}"; do for h in "${host_list[@]}"; do
[ -f /sys/class/scsi_host/${h}/scan ] && echo "- - -" > /sys/class/scsi_host/${h}/scan [ -f "/sys/class/scsi_host/${h}/scan" ] && echo "- - -" > "/sys/class/scsi_host/${h}/scan"
done done
# After the drive is reconnected, $vg should be visible again. # After the drive is reconnected, $vg should be visible again.

View File

@ -15,8 +15,8 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest . lib/inittest
[ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip; [ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip
[ -z "$LVM_TEST_FAILURE" ] && skip; [ -z "$LVM_TEST_FAILURE" ] && skip
aux prepare_devs 3 aux prepare_devs 3
aux extend_filter_LVMTEST aux extend_filter_LVMTEST

View File

@ -31,8 +31,8 @@ done
aux extend_filter_LVMTEST aux extend_filter_LVMTEST
pvcreate "$DM_DEV_DIR"/$vg/$lv[12345] pvcreate "$DM_DEV_DIR"/$vg/${lv}[12345]
vgcreate $vg1 "$DM_DEV_DIR"/$vg/$lv[12345] vgcreate $vg1 "$DM_DEV_DIR"/$vg/${lv}[12345]
# #

View File

@ -53,8 +53,8 @@ do
# When fully zeroed, it should be zero - so almost no output from hexdump # When fully zeroed, it should be zero - so almost no output from hexdump
case "$i" in case "$i" in
0) test $(wc -l < out) -ge 10 ;; # should not be zeroed 0) test "$(wc -l < out)" -ge 10 ;; # should not be zeroed
1) test $(wc -l < out) -le 10 ;; # should be zeroed 1) test "$(wc -l < out)" -le 10 ;; # should be zeroed
esac esac
lvremove -f $vg/pool lvremove -f $vg/pool

View File

@ -168,7 +168,7 @@ vdo create $VDOCONF --name "$VDONAME" --device="$LOOP" --vdoLogicalSize=23G \
# Get VDO table line # Get VDO table line
dmsetup table "$VDONAME" | tr " " "\n" | sed -e '5,6d' -e '12d' | tee vdo-orig dmsetup table "$VDONAME" | tr " " "\n" | sed -e '5,6d' -e '12d' | tee vdo-orig
DM_DEV_DIR= lvm_import_vdo -y --name $vg/$lv "$LOOP" DM_DEV_DIR="" lvm_import_vdo -y --name $vg/$lv "$LOOP"
lvs -a $vg lvs -a $vg
dmsetup table "$vg-${lv}_vpool-vpool" | tr " " "\n" | sed -e '5,6d' -e '12d' | tee new-vdo-lv dmsetup table "$vg-${lv}_vpool-vpool" | tr " " "\n" | sed -e '5,6d' -e '12d' | tee new-vdo-lv