You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

60 lines
1.7 KiB

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