Blame SOURCES/bz1808468-2-remove-locking_type.patch

d42a06
From a007883ff1537cbcb79765d174694b54b0da7acc Mon Sep 17 00:00:00 2001
d42a06
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
d42a06
Date: Thu, 27 Feb 2020 11:51:31 +0100
d42a06
Subject: [PATCH] lvmlockd: remove locking_type parameter from lvm.conf for LVM
d42a06
 > v2.03
d42a06
d42a06
---
d42a06
 heartbeat/lvmlockd | 24 ++++++++++++++++++------
d42a06
 1 file changed, 18 insertions(+), 6 deletions(-)
d42a06
d42a06
diff --git a/heartbeat/lvmlockd b/heartbeat/lvmlockd
d42a06
index e80c7647e..c0c45f879 100755
d42a06
--- a/heartbeat/lvmlockd
d42a06
+++ b/heartbeat/lvmlockd
d42a06
@@ -190,19 +190,31 @@ setup_lvm_config()
d42a06
 	# To use lvmlockd, ensure configure lvm.conf:
d42a06
 	# locking_type = 1
d42a06
 	# use_lvmlockd = 1
d42a06
-	out=$(lvmconfig 'global/use_lvmlockd')
d42a06
+	out=$(lvmconfig 'global/use_lvmlockd' 2> /dev/null)
d42a06
 	use_lvmlockd=$(echo "$out" | cut -d'=' -f2)
d42a06
 
d42a06
-	out=$(lvmconfig 'global/locking_type')
d42a06
+	out=$(lvmconfig 'global/locking_type' 2> /dev/null)
d42a06
 	lock_type=$(echo "$out" | cut -d'=' -f2)
d42a06
 
d42a06
-	if [ "$use_lvmlockd" != 1 ] ; then
d42a06
+	if [ -n "$use_lvmlockd" ] && [ "$use_lvmlockd" != 1 ] ; then
d42a06
 		ocf_log info "setting \"use_lvmlockd=1\" in /etc/lvm/lvm.conf ..."
d42a06
 		sed -i 's,^[[:blank:]]*use_lvmlockd[[:blank:]]*=.*,\ \ \ \ use_lvmlockd = 1,g' /etc/lvm/lvm.conf
d42a06
 	fi
d42a06
-	if [ "$lock_type" != 1 ] ; then
d42a06
-		ocf_log info "setting \"locking_type=1\" in /etc/lvm/lvm.conf ..."
d42a06
-		sed -i 's,^[[:blank:]]*locking_type[[:blank:]]*=.*,\ \ \ \ locking_type = 1,g' /etc/lvm/lvm.conf
d42a06
+	if [ -n "$lock_type" ] ; then
d42a06
+		# locking_type was removed from config in v2.03
d42a06
+		ocf_version_cmp "$(lvmconfig --version | awk '/LVM ver/ {sub(/\(.*/, "", $3); print $3}')" "2.03"
d42a06
+		case "$?" in
d42a06
+			1|2)
d42a06
+				ocf_log info "removing \"locking_type\" from /etc/lvm/lvm.conf ..."
d42a06
+				sed -i '/^[[:blank:]]*locking_type[[:blank:]]*=.*/d' /etc/lvm/lvm.conf
d42a06
+				;;
d42a06
+			0)
d42a06
+				if [ "$lock_type" != 1 ] ; then
d42a06
+					ocf_log info "setting \"locking_type=1\" in /etc/lvm/lvm.conf ..."
d42a06
+					sed -i 's,^[[:blank:]]*locking_type[[:blank:]]*=.*,\ \ \ \ locking_type = 1,g' /etc/lvm/lvm.conf
d42a06
+				fi
d42a06
+				;;
d42a06
+		esac
d42a06
 	fi
d42a06
 
d42a06
 	return $OCF_SUCCESS