Skip to content

Commit c0a54f2

Browse files
teiglandjohannbg
authored andcommitted
feat(lvm): update lvm command options
Drop checking for options that have been available for at least ten years. This simplifies code maintenance. Add the new --nohints option (when available) to disable the use of hints which is not useful during startup.
1 parent 97543cc commit c0a54f2

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

modules.d/90lvm/lvm_scan.sh

+22-19
Original file line numberDiff line numberDiff line change
@@ -59,39 +59,42 @@ min=$2
5959
sub=${3%% *}
6060
sub=${sub%%\(*}
6161

62-
lvm_ignorelockingfailure="--ignorelockingfailure"
63-
lvm_quirk_args="--ignorelockingfailure --ignoremonitoring"
64-
65-
check_lvm_ver 2 2 57 "$maj" "$min" "$sub" \
66-
&& lvm_quirk_args="$lvm_quirk_args --poll n"
67-
68-
if check_lvm_ver 2 2 65 "$maj" "$min" "$sub"; then
69-
lvm_quirk_args=" --sysinit $extraargs"
70-
fi
71-
72-
if check_lvm_ver 2 2 221 "$maj" "$min" "$sub"; then
73-
lvm_quirk_args=" $extraargs"
74-
unset lvm_ignorelockingfailure
75-
fi
76-
62+
# For lvchange and vgchange use --sysinit which:
63+
# disables polling (--poll n)
64+
# ignores monitoring (--ignoremonitoring)
65+
# ignores locking failures (--ignorelockingfailure)
66+
# disables hints (--nohints)
67+
#
68+
# For lvscan and vgscan:
69+
# disable locking (--nolocking)
70+
# disable hints (--nohints)
71+
72+
activate_args="--sysinit $extraargs"
7773
unset extraargs
7874

7975
export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
8076

77+
scan_args="--nolocking"
78+
79+
check_lvm_ver 2 3 14 "$maj" "$min" "$sub" \
80+
&& scan_args="$scan_args --nohints"
81+
8182
if [ -n "$LVS" ]; then
8283
info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
83-
lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo
84+
# shellcheck disable=SC2086
85+
lvm lvscan $scan_args 2>&1 | vinfo
8486
for LV in $LVS; do
8587
# shellcheck disable=SC2086
86-
lvm lvchange --yes -K -ay $lvm_quirk_args "$LV" 2>&1 | vinfo
88+
lvm lvchange --yes -K -ay $activate_args "$LV" 2>&1 | vinfo
8789
done
8890
fi
8991

9092
if [ -z "$LVS" ] || [ -n "$VGS" ]; then
9193
info "Scanning devices $lvmdevs for LVM volume groups $VGS"
92-
lvm vgscan $lvm_ignorelockingfailure 2>&1 | vinfo
9394
# shellcheck disable=SC2086
94-
lvm vgchange -ay $lvm_quirk_args $VGS 2>&1 | vinfo
95+
lvm vgscan $scan_args 2>&1 | vinfo
96+
# shellcheck disable=SC2086
97+
lvm vgchange -ay $activate_args $VGS 2>&1 | vinfo
9598
fi
9699

97100
if [ "$lvmwritten" ]; then

0 commit comments

Comments
 (0)