Blame SOURCES/bz1549579-1-clvm-exclusive-mode-support.patch

81fafb
From fa434dc0f5a40ebd371874744174defa11407a5f Mon Sep 17 00:00:00 2001
81fafb
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
81fafb
Date: Tue, 30 Oct 2018 13:39:38 +0100
81fafb
Subject: [PATCH] clvm: support exclusive mode
81fafb
81fafb
---
81fafb
 heartbeat/clvm.in | 19 +++++++++++++++++--
81fafb
 1 file changed, 17 insertions(+), 2 deletions(-)
81fafb
81fafb
diff --git a/heartbeat/clvm.in b/heartbeat/clvm.in
81fafb
index 5197b50f4..3ab196199 100644
81fafb
--- a/heartbeat/clvm.in
81fafb
+++ b/heartbeat/clvm.in
81fafb
@@ -72,6 +72,15 @@ is set to.
81fafb
 <content type="boolean" default="true"/>
81fafb
 </parameter>
81fafb
 
81fafb
+<parameter name="exclusive" unique="0" required="0">
81fafb
+<longdesc lang="en">
81fafb
+If set, only exclusive volume groups will be monitored.
81fafb
+</longdesc>
81fafb
+<shortdesc lang="en">Only monitor exclusive volume groups</shortdesc>
81fafb
+<content type="boolean" default="false" />
81fafb
+</parameter>
81fafb
+
81fafb
+
81fafb
 </parameters>
81fafb
 
81fafb
 <actions>
81fafb
@@ -215,7 +224,13 @@ clvmd_status()
81fafb
 
81fafb
 # NOTE: replace this with vgs, once display filter per attr is implemented.
81fafb
 clustered_vgs() {
81fafb
-	${LVM_VGDISPLAY} 2>/dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'
81fafb
+	if ! ocf_is_true "$OCF_RESKEY_exclusive"; then
81fafb
+		${LVM_VGDISPLAY} 2>/dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'
81fafb
+	else
81fafb
+		for vg in $(vgs --select "clustered=yes" -o name --noheadings); do
81fafb
+			lvs --select lv_active=~'local.*exclusive' -o vg_name --noheadings $vg 2> /dev/null | awk '!seen[$1]++ {print $1}'
81fafb
+		done
81fafb
+	fi
81fafb
 }
81fafb
 
81fafb
 wait_for_process()
81fafb
@@ -374,7 +389,7 @@ clvmd_start()
81fafb
 		return $?;
81fafb
 	fi
81fafb
 
81fafb
-	# autoset locking type to clusted when lvmconf tool is available
81fafb
+	# autoset locking type to clustered when lvmconf tool is available
81fafb
 	if [ -x "$LVMCONF"  ]; then
81fafb
 		$LVMCONF --enable-cluster > /dev/null 2>&1
81fafb
 	fi