d1a34d
From 9ab4c18355df1e55c39ca96f27ddb9b540054286 Mon Sep 17 00:00:00 2001
d1a34d
From: David Teigland <teigland@redhat.com>
d1a34d
Date: Wed, 8 Dec 2021 14:43:58 -0600
d1a34d
Subject: [PATCH] feat(lvm): update lvm command options
d1a34d
d1a34d
Drop checking for options that have been available for
d1a34d
at least ten years.  This simplifies code maintenance.
d1a34d
d1a34d
Add the new --nohints option (when available) to disable
d1a34d
the use of hints which is not useful during startup.
d1a34d
d1a34d
(cherry picked from commit c0a54f2993b1d3c2101202c274a41f925445d54b)
d1a34d
d1a34d
Resolves: #2037955
d1a34d
---
d1a34d
 modules.d/90lvm/lvm_scan.sh | 41 ++++++++++++++++++++++-------------------
d1a34d
 1 file changed, 22 insertions(+), 19 deletions(-)
d1a34d
d1a34d
diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh
d1a34d
index 80382407..00143bff 100755
d1a34d
--- a/modules.d/90lvm/lvm_scan.sh
d1a34d
+++ b/modules.d/90lvm/lvm_scan.sh
d1a34d
@@ -59,39 +59,42 @@ min=$2
d1a34d
 sub=${3%% *}
d1a34d
 sub=${sub%%\(*}
d1a34d
 
d1a34d
-lvm_ignorelockingfailure="--ignorelockingfailure"
d1a34d
-lvm_quirk_args="--ignorelockingfailure --ignoremonitoring"
d1a34d
-
d1a34d
-check_lvm_ver 2 2 57 "$maj" "$min" "$sub" \
d1a34d
-    && lvm_quirk_args="$lvm_quirk_args --poll n"
d1a34d
-
d1a34d
-if check_lvm_ver 2 2 65 "$maj" "$min" "$sub"; then
d1a34d
-    lvm_quirk_args=" --sysinit $extraargs"
d1a34d
-fi
d1a34d
-
d1a34d
-if check_lvm_ver 2 2 221 "$maj" "$min" "$sub"; then
d1a34d
-    lvm_quirk_args=" $extraargs"
d1a34d
-    unset lvm_ignorelockingfailure
d1a34d
-fi
d1a34d
-
d1a34d
+# For lvchange and vgchange use --sysinit which:
d1a34d
+# disables polling (--poll n)
d1a34d
+# ignores monitoring (--ignoremonitoring)
d1a34d
+# ignores locking failures (--ignorelockingfailure)
d1a34d
+# disables hints (--nohints)
d1a34d
+#
d1a34d
+# For lvscan and vgscan:
d1a34d
+# disable locking (--nolocking)
d1a34d
+# disable hints (--nohints)
d1a34d
+
d1a34d
+activate_args="--sysinit $extraargs"
d1a34d
 unset extraargs
d1a34d
 
d1a34d
 export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
d1a34d
 
d1a34d
+scan_args="--nolocking"
d1a34d
+
d1a34d
+check_lvm_ver 2 3 14 "$maj" "$min" "$sub" \
d1a34d
+    && scan_args="$scan_args --nohints"
d1a34d
+
d1a34d
 if [ -n "$LVS" ]; then
d1a34d
     info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
d1a34d
-    lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo
d1a34d
+    # shellcheck disable=SC2086
d1a34d
+    lvm lvscan $scan_args 2>&1 | vinfo
d1a34d
     for LV in $LVS; do
d1a34d
         # shellcheck disable=SC2086
d1a34d
-        lvm lvchange --yes -K -ay $lvm_quirk_args "$LV" 2>&1 | vinfo
d1a34d
+        lvm lvchange --yes -K -ay $activate_args "$LV" 2>&1 | vinfo
d1a34d
     done
d1a34d
 fi
d1a34d
 
d1a34d
 if [ -z "$LVS" ] || [ -n "$VGS" ]; then
d1a34d
     info "Scanning devices $lvmdevs for LVM volume groups $VGS"
d1a34d
-    lvm vgscan $lvm_ignorelockingfailure 2>&1 | vinfo
d1a34d
     # shellcheck disable=SC2086
d1a34d
-    lvm vgchange -ay $lvm_quirk_args $VGS 2>&1 | vinfo
d1a34d
+    lvm vgscan $scan_args 2>&1 | vinfo
d1a34d
+    # shellcheck disable=SC2086
d1a34d
+    lvm vgchange -ay $activate_args $VGS 2>&1 | vinfo
d1a34d
 fi
d1a34d
 
d1a34d
 if [ "$lvmwritten" ]; then
d1a34d