Blame SOURCES/bz1159328-LVM-check_writethrough.patch

15862b
From 8d25da64ab9dee8545a0c52f7db08213a03ea106 Mon Sep 17 00:00:00 2001
15862b
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
15862b
Date: Tue, 28 Feb 2017 15:46:40 +0100
15862b
Subject: [PATCH] LVM: add check_writethrough parameter
15862b
15862b
---
15862b
 heartbeat/LVM | 19 +++++++++++++++++++
15862b
 1 file changed, 19 insertions(+)
15862b
15862b
diff --git a/heartbeat/LVM b/heartbeat/LVM
15862b
index 90a900b..5b265f5 100755
15862b
--- a/heartbeat/LVM
15862b
+++ b/heartbeat/LVM
15862b
@@ -29,6 +29,8 @@
15862b
 : ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
15862b
 . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
15862b
 
15862b
+OCF_RESKEY_check_writethrough_default="false"
15862b
+
15862b
 #######################################################################
15862b
 
15862b
 
15862b
@@ -106,6 +108,14 @@ logical volumes.
15862b
 <content type="string" default="false" />
15862b
 </parameter>
15862b
 
15862b
+<parameter name="check_writethrough" unique="0" required="0">
15862b
+<longdesc lang="en">
15862b
+If set to true, check if cache_mode is set to writethrough.
15862b
+</longdesc>
15862b
+<shortdesc lang="en">Check if cache_mode is set to writethrough</shortdesc>
15862b
+<content type="string" default="${OCF_RESKEY_check_writethrough_default}" />
15862b
+</parameter>
15862b
+
15862b
 </parameters>
15862b
 
15862b
 <actions>
15862b
@@ -583,6 +593,13 @@ LVM_validate_all() {
15862b
 		exit $OCF_ERR_GENERIC
15862b
 	fi
15862b
 
15862b
+	if ocf_is_true "$OCF_RESKEY_check_writethrough"; then
15862b
+		if ! lvs --noheadings -o cache_mode "$OCF_RESKEY_volgrpname" | grep -q "writethrough"; then
15862b
+			ocf_exit_reason "LVM cache is not in writethrough mode."
15862b
+			exit $OCF_ERR_CONFIGURED
15862b
+		fi
15862b
+	fi
15862b
+
15862b
 	##
15862b
 	# If exclusive activation is not enabled, then
15862b
 	# further checking of proper setup is not necessary
15862b
@@ -690,6 +707,8 @@ if [ -n "$OCF_RESKEY_tag" ]; then
15862b
 	OUR_TAG=$OCF_RESKEY_tag
15862b
 fi
15862b
 
15862b
+: ${OCF_RESKEY_check_writethrough=${OCF_RESKEY_check_writethrough_default}}
15862b
+
15862b
 # What kind of method was invoked?
15862b
 case "$1" in
15862b