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

39 lines
1.5 KiB
Diff
Raw Normal View History

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