059e59
From 2bfe8c53280b6c1e18339dddc5bb60b062cad5bb Mon Sep 17 00:00:00 2001
059e59
From: David Teigland <teigland@redhat.com>
059e59
Date: Wed, 8 Dec 2021 14:04:25 -0600
059e59
Subject: [PATCH] revert(lvm): remove snapshot feature
059e59
059e59
The feature of managing lvm snapshots has no known
059e59
recent usage.  It is unknown if it works.  The lvm
059e59
developers do not wish to maintain or support it.
059e59
059e59
(cherry picked from commit 1549d5e89818603e1aa6dd8a40981222f59f1548)
059e59
059e59
Resolves: #2037955
059e59
---
059e59
 modules.d/90lvm/lvm_scan.sh | 39 ++++-----------------------------------
059e59
 1 file changed, 4 insertions(+), 35 deletions(-)
059e59
059e59
diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh
059e59
index c42f97d5..43601ad1 100755
059e59
--- a/modules.d/90lvm/lvm_scan.sh
059e59
+++ b/modules.d/90lvm/lvm_scan.sh
059e59
@@ -7,8 +7,6 @@ type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
059e59
 
059e59
 VGS=$(getargs rd.lvm.vg -d rd_LVM_VG=)
059e59
 LVS=$(getargs rd.lvm.lv -d rd_LVM_LV=)
059e59
-SNAPSHOT=$(getargs rd.lvm.snapshot -d rd_LVM_SNAPSHOT=)
059e59
-SNAPSIZE=$(getargs rd.lvm.snapsize -d rd_LVM_SNAPSIZE=)
059e59
 
059e59
 # shellcheck disable=SC2174
059e59
 [ -d /etc/lvm ] || mkdir -m 0755 -p /etc/lvm
059e59
@@ -31,17 +29,10 @@ if [ ! -e /etc/lvm/lvm.conf ]; then
059e59
         echo '}'
059e59
 
059e59
         # establish LVM locking
059e59
-        if [ -n "$SNAPSHOT" ]; then
059e59
-            echo 'global {'
059e59
-            echo '    locking_type = 1'
059e59
-            echo '    use_lvmetad = 0'
059e59
-            echo '}'
059e59
-        else
059e59
-            echo 'global {'
059e59
-            echo '    locking_type = 4'
059e59
-            echo '    use_lvmetad = 0'
059e59
-            echo '}'
059e59
-        fi
059e59
+        echo 'global {'
059e59
+        echo '    locking_type = 4'
059e59
+        echo '    use_lvmetad = 0'
059e59
+        echo '}'
059e59
     } > /etc/lvm/lvm.conf
059e59
     lvmwritten=1
059e59
 fi
059e59
@@ -90,28 +81,6 @@ unset extraargs
059e59
 
059e59
 export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
059e59
 
059e59
-if [ -n "$SNAPSHOT" ]; then
059e59
-    # HACK - this should probably be done elsewhere or turned into a function
059e59
-    # Enable read-write LVM locking
059e59
-    sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type =  1/' /etc/lvm/lvm.conf
059e59
-
059e59
-    # Expected SNAPSHOT format "<orig lv name>:<snap lv name>"
059e59
-    ORIG_LV=${SNAPSHOT%%:*}
059e59
-    SNAP_LV=${SNAPSHOT##*:}
059e59
-
059e59
-    info "Removing existing LVM snapshot $SNAP_LV"
059e59
-    lvm lvremove --force "$SNAP_LV" 2>&1 | vinfo
059e59
-
059e59
-    # Determine snapshot size
059e59
-    if [ -z "$SNAPSIZE" ]; then
059e59
-        SNAPSIZE=$(lvm lvs --noheadings --units m --options lv_size "$ORIG_LV")
059e59
-        info "No LVM snapshot size provided, using size of $ORIG_LV ($SNAPSIZE)"
059e59
-    fi
059e59
-
059e59
-    info "Creating LVM snapshot $SNAP_LV ($SNAPSIZE)"
059e59
-    lvm lvcreate -s -n "$SNAP_LV" -L "$SNAPSIZE" "$ORIG_LV" 2>&1 | vinfo
059e59
-fi
059e59
-
059e59
 if [ -n "$LVS" ]; then
059e59
     info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
059e59
     lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo
059e59