skip longhorn iscsi devices in disklayout.conf

Resolves: RHEL-83551
This commit is contained in:
Lukáš Zaoral 2025-07-30 16:07:45 +02:00 committed by Pavel Cahyna
parent 1b75b9dd93
commit 74e7370f63
2 changed files with 111 additions and 0 deletions

View File

@ -0,0 +1,107 @@
From 71e854e28db3b02497cd48637cc22bda843ccab0 Mon Sep 17 00:00:00 2001
From: gdha <gratien.dhaese@gmail.com>
Date: Thu, 13 Feb 2025 15:59:31 +0100
Subject: [PATCH 1/2] #3401 discard longhorn devices
Signed-off-by: gdha <gratien.dhaese@gmail.com>
---
.../save/GNU/Linux/230_filesystem_layout.sh | 59 ++++++++++---------
1 file changed, 30 insertions(+), 29 deletions(-)
diff --git a/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh b/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
index 15e104403..6ac35c8db 100644
--- a/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
+++ b/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
@@ -117,37 +117,38 @@ fi
Log "Filesystem $fstype on $device mounted at $mountpoint is below Docker Root Dir $docker_root_dir, skipping."
continue
fi
- # In case Longhorn is rebuilding a replica device it will show up as a pseudo-device and when that is the
- # case then you would find traces of it in the /var/lib/rear/layout/disklayout.conf file, which would
- # break the recovery as Longhorn Engine replica's are under control of Rancher Longhorn software and these are
- # rebuild automatically via kubernetes longhorn-engine pods.
- # Issue where we discovered this behavior was #2365
- # In normal situations you will find traces of longhorn in the log saying skipping non-block devices.
- # For example an output of the 'df' command:
- # /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792 82045336 4500292 77528660 6% /var/lib/kubelet/pods/7f47aa55-30e2-4e7b-8fec-ec9a1e761352/volumes/kubernetes.io~csi/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792/mount
- # lsscsi shows it as:
- # [34:0:0:0] storage IET Controller 0001 -
- # [34:0:0:1] disk IET VIRTUAL-DISK 0001 /dev/sdf
- # ls -l /dev/sdf /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792
- # brw-rw---- 1 root disk 8, 80 Apr 17 12:02 /dev/sdf
- # brw-rw---- 1 root root 8, 64 Apr 17 10:36 /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792
- # and parted says:
- # parted /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792 print
- # Model: IET VIRTUAL-DISK (scsi)
- # Disk /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792: 85.9GB
- # Sector size (logical/physical): 512B/512B
- # Partition Table: loop
- # Disk Flags:
- # Number Start End Size File system Flags
- # 1 0.00B 85.9GB 85.9GB ext4
- # => as result (without the next if clausule) we would end up with an entry in the disklayout.conf file:
- # fs /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792 /var/lib/kubelet/pods/61ed399a-d51b-40b8-8fe8-a78e84a1dd0b/volumes/kubernetes.io~csi/pvc-c65df331-f1c5-466a-9731-b2aa5e6da714/mount ext4 uuid=4fafdd40-a9ae-4b62-8bfb-f29036dbe3b9 label= blocksize=4096 reserved_blocks=0% max_mounts=-1 check_interval=0d bytes_per_inode=16384 default_mount_options=user_xattr,acl options=rw,relatime,data=ordered
- if echo "$device" | grep -q "^/dev/longhorn/pvc-" ; then
- Log "Longhorn Engine replica $device, skipping."
- continue
- fi
fi
fi
+ # In case Longhorn is rebuilding a replica device it will show up as a pseudo-device and when that is the
+ # case then you would find traces of it in the /var/lib/rear/layout/disklayout.conf file, which would
+ # break the recovery as Longhorn Engine replica's are under control of Rancher Longhorn software and these are
+ # rebuild automatically via kubernetes longhorn-engine pods.
+ # Issue where we discovered this behavior was #2365
+ # In normal situations you will find traces of longhorn in the log saying skipping non-block devices.
+ # For example an output of the 'df' command:
+ # /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792 82045336 4500292 77528660 6% /var/lib/kubelet/pods/7f47aa55-30e2-4e7b-8fec-ec9a1e761352/volumes/kubernetes.io~csi/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792/mount
+ # lsscsi shows it as:
+ # [34:0:0:0] storage IET Controller 0001 -
+ # [34:0:0:1] disk IET VIRTUAL-DISK 0001 /dev/sdf
+ # ls -l /dev/sdf /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792
+ # brw-rw---- 1 root disk 8, 80 Apr 17 12:02 /dev/sdf
+ # brw-rw---- 1 root root 8, 64 Apr 17 10:36 /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792
+ # and parted says:
+ # parted /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792 print
+ # Model: IET VIRTUAL-DISK (scsi)
+ # Disk /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792: 85.9GB
+ # Sector size (logical/physical): 512B/512B
+ # Partition Table: loop
+ # Disk Flags:
+ # Number Start End Size File system Flags
+ # 1 0.00B 85.9GB 85.9GB ext4
+ # => as result (without the next if clausule) we would end up with an entry in the disklayout.conf file:
+ # fs /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792 /var/lib/kubelet/pods/61ed399a-d51b-40b8-8fe8-a78e84a1dd0b/volumes/kubernetes.io~csi/pvc-c65df331-f1c5-466a-9731-b2aa5e6da714/mount ext4 uuid=4fafdd40-a9ae-4b62-8bfb-f29036dbe3b9 label= blocksize=4096 reserved_blocks=0% max_mounts=-1 check_interval=0d bytes_per_inode=16384 default_mount_options=user_xattr,acl options=rw,relatime,data=ordered
+ if echo "$device" | grep -q "^/dev/longhorn/pvc-" ; then
+ Log "Longhorn Engine replica $device, skipping."
+ continue
+ fi
+
# Replace a symbolic link /dev/disk/by-uuid/a1b2c3 -> ../../sdXn
# by the fully canonicalized target of the link e.g. /dev/sdXn
if [[ $device == /dev/disk/by-uuid* ]]; then
From 7805e8e440c9a2a2e7a890e8e70e5c7c285aee08 Mon Sep 17 00:00:00 2001
From: gdha <gratien.dhaese@gmail.com>
Date: Fri, 14 Feb 2025 08:22:26 +0100
Subject: [PATCH 2/2] replacing tab with spaces in comment
Signed-off-by: gdha <gratien.dhaese@gmail.com>
---
usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh b/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
index 6ac35c8db..b3dd4bbc0 100644
--- a/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
+++ b/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
@@ -119,7 +119,7 @@ fi
fi
fi
fi
- # In case Longhorn is rebuilding a replica device it will show up as a pseudo-device and when that is the
+ # In case Longhorn is rebuilding a replica device it will show up as a pseudo-device and when that is the
# case then you would find traces of it in the /var/lib/rear/layout/disklayout.conf file, which would
# break the recovery as Longhorn Engine replica's are under control of Rancher Longhorn software and these are
# rebuild automatically via kubernetes longhorn-engine pods.

View File

@ -91,6 +91,10 @@ Patch119: rear-multipath-bios-grub.patch
# https://github.com/rear/rear/pull/3125
Patch121: rear-improve-layout-guide.patch
# skip longhorn iscsi devices in disklayout.conf
# https://github.com/rear/rear/commit/d765abff976a8346ce6afa432c9a09d67ed63482
Patch122: rear-skip-longhorn-iscsi-RHEL-83551.patch
######################
# downstream patches #
######################