Blame SOURCES/bz1695039-LVM-activate-return-NOT_RUNNING-rejoin-cluster.patch

734564
From 4ee9a7026d7ed15b0b5cd26f06a21d04fc05d14e Mon Sep 17 00:00:00 2001
734564
From: Roger Zhou <zzhou@suse.com>
734564
Date: Mon, 1 Apr 2019 22:57:26 +0800
734564
Subject: [PATCH 1/2] LVM-activate: return OCF_NOT_RUNNING on initial probe
734564
734564
In the use case of lvm on top of cluster md/raid. When the fenced node
734564
rejoins to the cluster, Pacemaker will run the monitor action for the
734564
probe operation. At that time, LVM PV and VG won't exist before cluster
734564
md/raid get assembled, and the probe should return $OCF_NOT_RUNNING
734564
instead of $OCF_ERR_CONFIGURED.
734564
734564
Signed-off-by: Roger Zhou <zzhou@suse.com>
734564
---
734564
 heartbeat/LVM-activate | 6 ++++++
734564
 1 file changed, 6 insertions(+)
734564
734564
diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
734564
index 3c462c75c..91ac05c34 100755
734564
--- a/heartbeat/LVM-activate
734564
+++ b/heartbeat/LVM-activate
734564
@@ -329,6 +329,7 @@ lvmlockd_check()
734564
 	# Good: lvmlockd is running, and clvmd is not running
734564
 	if ! pgrep lvmlockd >/dev/null 2>&1 ; then
734564
 		if ocf_is_probe; then
734564
+			ocf_log info "initial probe: lvmlockd is not running yet."
734564
 			exit $OCF_NOT_RUNNING
734564
 		fi
734564
 
734564
@@ -481,6 +482,11 @@ lvm_validate() {
734564
 			exit $OCF_SUCCESS
734564
 		fi
734564
 
734564
+		if ocf_is_probe; then
734564
+			ocf_log info "initial probe: VG [${VG}] is not found on any block device yet."
734564
+			exit $OCF_NOT_RUNNING
734564
+		fi
734564
+
734564
 		ocf_exit_reason "Volume group[${VG}] doesn't exist, or not visible on this node!"
734564
 		exit $OCF_ERR_CONFIGURED
734564
 	fi
734564
734564
From df2f58c400b1f6f239f9e1c1fdf6ce0875639b43 Mon Sep 17 00:00:00 2001
734564
From: Roger Zhou <zzhou@suse.com>
734564
Date: Mon, 1 Apr 2019 23:02:54 +0800
734564
Subject: [PATCH 2/2] LVM-activate: align dmsetup report command to standard
734564
734564
Namely to change 'vgname/lvname' to 'vg_name/lv_name'.  The dmsetup
734564
report command follows lvm2 selection criteria field name standard.
734564
- dmsetup v1.02.86 (lvm2 v2_02_107) - 23rd June 2014
734564
  "Add dmsetup -S/--select to define selection criteria"
734564
- dmsetup info -c -S help
734564
734564
Signed-off-by: Roger Zhou <zzhou@suse.com>
734564
---
734564
 heartbeat/LVM-activate | 6 +++---
734564
 1 file changed, 3 insertions(+), 3 deletions(-)
734564
734564
diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
734564
index 91ac05c34..730d9a09d 100755
734564
--- a/heartbeat/LVM-activate
734564
+++ b/heartbeat/LVM-activate
734564
@@ -707,7 +707,7 @@ tagging_deactivate() {
734564
 # method:
734564
 #
734564
 # lv_count=$(vgs --foreign -o lv_count --noheadings ${VG} 2>/dev/null | tr -d '[:blank:]')
734564
-# dm_count=$(dmsetup --noheadings info -c -S "vgname=${VG}" 2>/dev/null | grep -c "${VG}-")
734564
+# dm_count=$(dmsetup --noheadings info -c -S "vg_name=${VG}" 2>/dev/null | grep -c "${VG}-")
734564
 # test $lv_count -eq $dm_count
734564
 #
734564
 # It works, but we cannot afford to use LVM command in lvm_status. LVM command is expensive
734564
@@ -730,9 +730,9 @@ lvm_status() {
734564
 	if [ -n "${LV}" ]; then
734564
 		# dmsetup ls? It cannot accept device name. It's
734564
 		# too heavy to list all DM devices.
734564
-		dm_count=$(dmsetup info --noheadings --noflush -c -S "vgname=${VG} && lvname=${LV}" | grep -c -v '^No devices found')
734564
+		dm_count=$(dmsetup info --noheadings --noflush -c -S "vg_name=${VG} && lv_name=${LV}" | grep -c -v '^No devices found')
734564
 	else
734564
-		dm_count=$(dmsetup info --noheadings --noflush -c -S "vgname=${VG}" | grep -c -v '^No devices found')
734564
+		dm_count=$(dmsetup info --noheadings --noflush -c -S "vg_name=${VG}" | grep -c -v '^No devices found')
734564
 	fi
734564
 
734564
 	if [ $dm_count -eq 0 ]; then