From c4a50be38c3ec593adbc8c5ea5ee3a93e4a41fd4 Mon Sep 17 00:00:00 2001 From: Pavel Cahyna Date: Mon, 14 Feb 2022 00:19:11 +0100 Subject: [PATCH] Apply upstream PR#2750 Avoid exclusion of wanted multipath devices when many multipath devices are present Resolves: rhbz2049091 --- rear-bz2049091.patch | 25 +++++++++++++++++++++++++ rear.spec | 1 + 2 files changed, 26 insertions(+) create mode 100644 rear-bz2049091.patch diff --git a/rear-bz2049091.patch b/rear-bz2049091.patch new file mode 100644 index 0000000..9f5e12d --- /dev/null +++ b/rear-bz2049091.patch @@ -0,0 +1,25 @@ +diff --git a/usr/share/rear/layout/save/default/335_remove_excluded_multipath_vgs.sh b/usr/share/rear/layout/save/default/335_remove_excluded_multipath_vgs.sh +index 040e9eec..e731c994 100644 +--- a/usr/share/rear/layout/save/default/335_remove_excluded_multipath_vgs.sh ++++ b/usr/share/rear/layout/save/default/335_remove_excluded_multipath_vgs.sh +@@ -19,9 +19,9 @@ while read lvmdev name mpdev junk ; do + # Remember, multipath devices from a volume group that is "excluded" should be 'commented out' + device=$(echo $mpdev | cut -c1-45) + while read LINE ; do +- # Now we need to comment all lines that contain "$devices" in the LAYOUT_FILE ++ # Now we need to comment all lines that contain "$device" in the LAYOUT_FILE + sed -i "s|^$LINE|\#$LINE|" "$LAYOUT_FILE" +- done < <(grep "$device" $LAYOUT_FILE | grep -v "^#") ++ done < <(grep " $device " $LAYOUT_FILE | grep -v "^#") + Log "Excluding multipath device $device" + done < <(grep "^#lvmdev" $LAYOUT_FILE) + +@@ -31,7 +31,7 @@ done < <(grep "^#lvmdev" $LAYOUT_FILE) + while read LINE ; do + # multipath /dev/mapper/360060e8007e2e3000030e2e300002065 /dev/sdae,/dev/sdat,/dev/sdbi,/dev/sdp + device=$(echo $LINE | awk '{print $2}' | cut -c1-45) +- num=$(grep "$device" $LAYOUT_FILE | grep -v "^#" | wc -l) ++ num=$(grep " $device " $LAYOUT_FILE | grep -v "^#" | wc -l) + if [ $num -lt 2 ] ; then + # If the $device is only seen once (in a uncommented line) then the multipath is not in use + sed -i "s|^$LINE|\#$LINE|" "$LAYOUT_FILE" diff --git a/rear.spec b/rear.spec index 2bc3540..3862d81 100644 --- a/rear.spec +++ b/rear.spec @@ -25,6 +25,7 @@ Patch34: rear-tmpdir.patch Patch35: rear-bz1983013.patch Patch36: rear-bz1993296.patch Patch37: rear-bz1747468.patch +Patch38: rear-bz2049091.patch # rear contains only bash scripts plus documentation so that on first glance it could be "BuildArch: noarch" # but actually it is not "noarch" because it only works on those architectures that are explicitly supported.