blob: 2ff0c377d364e72b9eeb29b211342b9120388b7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
From c0a54f2993b1d3c2101202c274a41f925445d54b Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Wed, 8 Dec 2021 14:43:58 -0600
Subject: [PATCH] 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.
---
modules.d/90lvm/lvm_scan.sh | 41 ++++++++++++++++++++++-------------------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh
index 8038240..00143bf 100755
--- a/modules.d/90lvm/lvm_scan.sh
+++ b/modules.d/90lvm/lvm_scan.sh
@@ -59,39 +59,42 @@ min=$2
sub=${3%% *}
sub=${sub%%\(*}
-lvm_ignorelockingfailure="--ignorelockingfailure"
-lvm_quirk_args="--ignorelockingfailure --ignoremonitoring"
-
-check_lvm_ver 2 2 57 "$maj" "$min" "$sub" \
- && lvm_quirk_args="$lvm_quirk_args --poll n"
-
-if check_lvm_ver 2 2 65 "$maj" "$min" "$sub"; then
- lvm_quirk_args=" --sysinit $extraargs"
-fi
-
-if check_lvm_ver 2 2 221 "$maj" "$min" "$sub"; then
- lvm_quirk_args=" $extraargs"
- unset lvm_ignorelockingfailure
-fi
-
+# For lvchange and vgchange use --sysinit which:
+# disables polling (--poll n)
+# ignores monitoring (--ignoremonitoring)
+# ignores locking failures (--ignorelockingfailure)
+# disables hints (--nohints)
+#
+# For lvscan and vgscan:
+# disable locking (--nolocking)
+# disable hints (--nohints)
+
+activate_args="--sysinit $extraargs"
unset extraargs
export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
+scan_args="--nolocking"
+
+check_lvm_ver 2 3 14 "$maj" "$min" "$sub" \
+ && scan_args="$scan_args --nohints"
+
if [ -n "$LVS" ]; then
info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
- lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo
+ # shellcheck disable=SC2086
+ lvm lvscan $scan_args 2>&1 | vinfo
for LV in $LVS; do
# shellcheck disable=SC2086
- lvm lvchange --yes -K -ay $lvm_quirk_args "$LV" 2>&1 | vinfo
+ lvm lvchange --yes -K -ay $activate_args "$LV" 2>&1 | vinfo
done
fi
if [ -z "$LVS" ] || [ -n "$VGS" ]; then
info "Scanning devices $lvmdevs for LVM volume groups $VGS"
- lvm vgscan $lvm_ignorelockingfailure 2>&1 | vinfo
# shellcheck disable=SC2086
- lvm vgchange -ay $lvm_quirk_args $VGS 2>&1 | vinfo
+ lvm vgscan $scan_args 2>&1 | vinfo
+ # shellcheck disable=SC2086
+ lvm vgchange -ay $activate_args $VGS 2>&1 | vinfo
fi
if [ "$lvmwritten" ]; then
--
1.8.3.1
|