Blame SOURCES/rear-bz2091163.patch

17042a
diff --git a/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh b/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh
17042a
index d3c9ae86..f21845df 100644
17042a
--- a/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh
17042a
+++ b/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh
17042a
@@ -70,14 +70,20 @@ local lvs_exit_code
17042a
     # Get physical_device configuration.
17042a
     # Format: lvmdev <volume_group> <device> [<uuid>] [<size(bytes)>]
17042a
     header_printed="no"
17042a
-    # Example output of "lvm pvdisplay -c":
17042a
-    #   /dev/sda1:system:41940992:-1:8:8:-1:4096:5119:2:5117:7wwpcO-KmNN-qsTE-7sp7-JBJS-vBdC-Zyt1W7
17042a
+    # Set pvdisplay separator to '|' to prevent issues with a colon in the path under /dev/disk/by-path
17042a
+    # that contains a ':' in the SCSI slot name.
17042a
+    # Example output of "lvm pvdisplay -C --separator '|' --noheadings --nosuffix --units=b -o pv_name,vg_name,pv_size,pv_uuid"
17042a
+    # on a system where LVM is configured to show the /dev/disk/by-path device names instead of the usual
17042a
+    # /dev/sda etc. (by using a setting like
17042a
+    # filter = [ "r|/dev/disk/by-path/.*-usb-|", "a|/dev/disk/by-path/pci-.*-nvme-|", "a|/dev/disk/by-path/pci-.*-scsi-|", "a|/dev/disk/by-path/pci-.*-ata-|", "a|/dev/disk/by-path/pci-.*-sas-|", "a|loop|", "r|.*|" ]
17042a
+    # in /etc/lvm/lvm.conf):
17042a
+    #   /dev/disk/by-path/pci-0000:03:00.0-scsi-0:0:1:0-part1|system|107340627968|7wwpcO-KmNN-qsTE-7sp7-JBJS-vBdC-Zyt1W7
17042a
     # There are two leading blanks in the output (at least on SLES12-SP4 with LVM 2.02.180).
17042a
-    lvm pvdisplay -c | while read line ; do
17042a
+    lvm pvdisplay -C --separator '|' --noheadings --nosuffix --units=b -o pv_name,vg_name,pv_size,pv_uuid | while read line ; do
17042a
 
17042a
-        # With the above example pdev=/dev/sda1
17042a
+        # With the above example pdev=/dev/disk/by-path/pci-0000:03:00.0-scsi-0:0:1:0-part1
17042a
         # (the "echo $line" makes the leading blanks disappear)
17042a
-        pdev=$( echo $line | cut -d ":" -f "1" )
17042a
+        pdev=$( echo $line | cut -d "|" -f "1" )
17042a
 
17042a
         # Skip lines that are not describing physical devices
17042a
         # i.e. lines where pdev does not start with a leading / character:
17042a
@@ -91,11 +97,11 @@ local lvs_exit_code
17042a
         fi
17042a
 
17042a
         # With the above example vgrp=system
17042a
-        vgrp=$( echo $line | cut -d ":" -f "2" )
17042a
-        # With the above example size=41940992
17042a
-        size=$( echo $line | cut -d ":" -f "3" )
17042a
+        vgrp=$( echo $line | cut -d "|" -f "2" )
17042a
+        # With the above example size=107340627968
17042a
+        size=$( echo $line | cut -d "|" -f "3" )
17042a
         # With the above example uuid=7wwpcO-KmNN-qsTE-7sp7-JBJS-vBdC-Zyt1W7
17042a
-        uuid=$( echo $line | cut -d ":" -f "12" )
17042a
+        uuid=$( echo $line | cut -d "|" -f "4" )
17042a
 
17042a
         # Translate pdev through diskbyid_mappings file:
17042a
         pdev=$( get_device_mapping $pdev )