Blame SOURCES/bz2049414-Filesystem-2-improve-uuid-label-device-logic.patch

4ff291
From d9b46474fc19d9c57e2cfb752d60319017da8410 Mon Sep 17 00:00:00 2001
4ff291
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
4ff291
Date: Wed, 6 Apr 2022 14:14:19 +0200
4ff291
Subject: [PATCH] Filesystem: improve logic for UUID/label and add note that
4ff291
 /dev/disk/by-{uuid,label}/ are preferred on Linux
4ff291
4ff291
---
4ff291
 heartbeat/Filesystem | 8 +++++---
4ff291
 1 file changed, 5 insertions(+), 3 deletions(-)
4ff291
4ff291
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
4ff291
index 72a1b8623..44270ad98 100755
4ff291
--- a/heartbeat/Filesystem
4ff291
+++ b/heartbeat/Filesystem
4ff291
@@ -163,6 +163,8 @@ directory where the status file is to be placed.
4ff291
 <parameter name="device" required="1">
4ff291
 <longdesc lang="en">
4ff291
 The name of block device for the filesystem, or -U, -L options for mount, or NFS mount specification.
4ff291
+
4ff291
+NOTE: On Linux /dev/disk/by-{uuid,label}/ are preferred to -U/-L.
4ff291
 </longdesc>
4ff291
 <shortdesc lang="en">block device</shortdesc>
4ff291
 <content type="string" default="${OCF_RESKEY_device_default}" />
4ff291
@@ -902,11 +904,11 @@ set_blockdevice_var() {
4ff291
 	fi
4ff291
 
4ff291
 	case "$DEVICE" in
4ff291
-	--*) # Typically --uuid or --label
4ff291
-		device_opt=$(echo $DEVICE | sed -E "s/([[:blank:]]|=).*//")
4ff291
+	--uuid=*|--uuid\ *|--label=*|--label\ *)
4ff291
+		device_opt=$(echo $DEVICE | sed "s/\([[:blank:]]\|=\).*//")
4ff291
 		DEVICE=$(echo $DEVICE | sed -E "s/$device_opt([[:blank:]]*|=)//")
4ff291
 		;;
4ff291
-	-*)  # Oh... An option to mount instead...  Typically -U or -L
4ff291
+	-U*|-L*)  # short versions of --uuid/--label
4ff291
 		device_opt=$(echo $DEVICE | cut -c1-2)
4ff291
 		DEVICE=$(echo $DEVICE | sed "s/$device_opt[[:blank:]]*//")
4ff291
 		;;