Blame 0094-lvm-remove-all-quirk-arguments.patch

Harald Hoyer bb31e7
From 53a738465371db3cb7df533a3ae2b5648dfd13e4 Mon Sep 17 00:00:00 2001
Harald Hoyer bb31e7
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer bb31e7
Date: Tue, 10 Nov 2015 17:55:50 +0100
Harald Hoyer bb31e7
Subject: [PATCH] lvm: remove all quirk arguments
Harald Hoyer bb31e7
Harald Hoyer bb31e7
https://bugzilla.redhat.com/show_bug.cgi?id=742564
Harald Hoyer bb31e7
Harald Hoyer bb31e7
Once lvm2 starts using /run (bug 742554), it should be no longer
Harald Hoyer bb31e7
necessary to disable file-based locking in the vgchange call in
Harald Hoyer bb31e7
fedora-storage-init.
Harald Hoyer bb31e7
Removing '--sysinit' will make it safe to call LVM operations
Harald Hoyer bb31e7
concurrently from other units.
Harald Hoyer bb31e7
Harald Hoyer bb31e7
The --sysinit is a compound option consisting of:
Harald Hoyer bb31e7
Harald Hoyer bb31e7
  -> --ignorelockingfailure - not needed anymore, the /run/lock/lvm is
Harald Hoyer bb31e7
available rw soon in boot process
Harald Hoyer bb31e7
Harald Hoyer bb31e7
  -> --ignoremonitoring - not needed since /run is available, this would
Harald Hoyer bb31e7
require the dm-event.service to be run before
Harald Hoyer bb31e7
fedora-storage-init.service (and new lvm2-activation.service when
Harald Hoyer bb31e7
deployed). But that's a one line change - I'll have a look whether it
Harald Hoyer bb31e7
plays well with other services and if yes, I'll commit the change. N.B.:
Harald Hoyer bb31e7
This has a consequence that all volumes activated on vgchange -ay will
Harald Hoyer bb31e7
be monitored at the same time they're activated (which is a plus I
Harald Hoyer bb31e7
think). The lvm2-monitor will just grab all the other volumes not
Harald Hoyer bb31e7
activated at the time of the boot's vgchange -ay call. But that's not an
Harald Hoyer bb31e7
issue (for already monitored volumes, calling vgchange --monitor y will
Harald Hoyer bb31e7
just be a NOOP).
Harald Hoyer bb31e7
Harald Hoyer bb31e7
 -> --poll n - not needed, we can run the polldaemon as the /run is
Harald Hoyer bb31e7
available and rw (in case there's unfinished merge or mirror sync from
Harald Hoyer bb31e7
previous system run, the poll-daemon will be triggered at boot now).
Harald Hoyer bb31e7
Actually, the polldaemon should be triggered as a service like dmeventd
Harald Hoyer bb31e7
is, not forked off from the LVM command itself, like from vgchange in
Harald Hoyer bb31e7
this case - we still need to change this - there's a bug open for this
Harald Hoyer bb31e7
request already (bug #814857). However, we don't have this feature ready
Harald Hoyer bb31e7
yet so I need to check whether this is OK with the early boot process
Harald Hoyer bb31e7
with the current state.
Harald Hoyer bb31e7
---
Harald Hoyer bb31e7
 modules.d/90lvm/lvm_scan.sh | 28 ++++++++++++++--------------
Harald Hoyer bb31e7
 1 file changed, 14 insertions(+), 14 deletions(-)
Harald Hoyer bb31e7
Harald Hoyer bb31e7
diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh
Harald Hoyer bb31e7
index ead28aa..8bf0864 100755
Harald Hoyer bb31e7
--- a/modules.d/90lvm/lvm_scan.sh
Harald Hoyer bb31e7
+++ b/modules.d/90lvm/lvm_scan.sh
Harald Hoyer bb31e7
@@ -69,11 +69,19 @@ min=$2
Harald Hoyer bb31e7
 sub=${3%% *}
Harald Hoyer bb31e7
 sub=${sub%%\(*};
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
+lvm_ignorelockingfailure="--ignorelockingfailure"
Harald Hoyer bb31e7
+lvm_quirk_args="--ignorelockingfailure --ignoremonitoring"
Harald Hoyer bb31e7
+
Harald Hoyer bb31e7
 check_lvm_ver 2 2 57 $maj $min $sub && \
Harald Hoyer bb31e7
-    nopoll="--poll n"
Harald Hoyer bb31e7
+    lvm_quirk_args="$lvm_quirk_args --poll n"
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 if check_lvm_ver 2 2 65 $maj $min $sub; then
Harald Hoyer bb31e7
-    sysinit=" --sysinit $extraargs"
Harald Hoyer bb31e7
+    lvm_quirk_args=" --sysinit $extraargs"
Harald Hoyer bb31e7
+fi
Harald Hoyer bb31e7
+
Harald Hoyer bb31e7
+if check_lvm_ver 2 2 221 $maj $min $sub; then
Harald Hoyer bb31e7
+    lvm_quirk_args=" $extraargs"
Harald Hoyer bb31e7
+    unset lvm_ignorelockingfailure
Harald Hoyer bb31e7
 fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 unset extraargs
Harald Hoyer bb31e7
@@ -104,24 +112,16 @@ fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 if [ -n "$LVS" ] ; then
Harald Hoyer bb31e7
     info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
Harald Hoyer bb31e7
-    lvm lvscan --ignorelockingfailure 2>&1 | vinfo
Harald Hoyer bb31e7
+    lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo
Harald Hoyer bb31e7
     for LV in $LVS; do
Harald Hoyer bb31e7
-        if [ -z "$sysinit" ]; then
Harald Hoyer bb31e7
-            lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LV 2>&1 | vinfo
Harald Hoyer bb31e7
-        else
Harald Hoyer bb31e7
-            lvm lvchange --yes -ay $sysinit $LV 2>&1 | vinfo
Harald Hoyer bb31e7
-        fi
Harald Hoyer bb31e7
+        lvm lvchange --yes -ay $lvm_quirk_args $LV 2>&1 | vinfo
Harald Hoyer bb31e7
     done
Harald Hoyer bb31e7
 fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 if [ -z "$LVS" -o -n "$VGS" ]; then
Harald Hoyer bb31e7
     info "Scanning devices $lvmdevs for LVM volume groups $VGS"
Harald Hoyer bb31e7
-    lvm vgscan --ignorelockingfailure 2>&1 | vinfo
Harald Hoyer bb31e7
-    if [ -z "$sysinit" ]; then
Harald Hoyer bb31e7
-        lvm vgchange -ay --ignorelockingfailure $nopoll --ignoremonitoring $VGS 2>&1 | vinfo
Harald Hoyer bb31e7
-    else
Harald Hoyer bb31e7
-        lvm vgchange -ay $sysinit $VGS 2>&1 | vinfo
Harald Hoyer bb31e7
-    fi
Harald Hoyer bb31e7
+    lvm vgscan $lvm_ignorelockingfailure 2>&1 | vinfo
Harald Hoyer bb31e7
+    lvm vgchange -ay $lvm_quirk_args $VGS 2>&1 | vinfo
Harald Hoyer bb31e7
 fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 if [ "$lvmwritten" ]; then