Blame SOURCES/rear-bz2091163.patch

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