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

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