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

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