resource-agents/SOURCES/bz1808468-2-remove-locking_type.patch
2021-09-10 03:52:59 +00:00

53 lines
2.0 KiB
Diff

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