Blame SOURCES/bz1214781-lvm-partial-activation-fix.patch.patch

261ad6
From 4e8c08a6d966f4e3deca03f4f1c4b5904939e640 Mon Sep 17 00:00:00 2001
261ad6
From: David Vossel <dvossel@redhat.com>
261ad6
Date: Thu, 25 Jun 2015 16:27:47 -0500
261ad6
Subject: [PATCH 2/3] bz1214781-lvm-partial-activation-fix.patch
261ad6
261ad6
---
261ad6
 heartbeat/LVM | 26 ++++++++++++++++++++++++--
261ad6
 1 file changed, 24 insertions(+), 2 deletions(-)
261ad6
261ad6
diff --git a/heartbeat/LVM b/heartbeat/LVM
261ad6
index 58cbe83..4b9c167 100755
261ad6
--- a/heartbeat/LVM
261ad6
+++ b/heartbeat/LVM
261ad6
@@ -568,8 +568,30 @@ LVM_validate_all() {
261ad6
 	##
261ad6
 	VGOUT=`vgck ${VOLUME} 2>&1`
261ad6
 	if [ $? -ne 0 ]; then
261ad6
-		ocf_exit_reason "Volume group [$VOLUME] does not exist or contains error! ${VGOUT}"
261ad6
-		exit $OCF_ERR_GENERIC
261ad6
+		# Inconsistency might be due to missing physical volumes, which doesn't 
261ad6
+		# automatically mean we should fail.  If partial_activation=true then 
261ad6
+		# we should let start try to handle it, or if no PVs are listed as
261ad6
+		# "unknown device" then another node may have marked a device missing 
261ad6
+		# where we have access to all of them and can start without issue. 
261ad6
+		if vgs -o pv_attr --noheadings $OCF_RESKEY_volgrpname 2>/dev/null | grep 'm' > /dev/null 2>&1; then
261ad6
+			if vgs -o pv_name --noheadings $OCF_RESKEY_volgrpname 2>/dev/null | grep 'unknown device' > /dev/null 2>&1; then
261ad6
+				if ! ocf_is_true "$OCF_RESKEY_partial_activation" ; then
261ad6
+					# We are missing devices and cannot activate partially
261ad6
+					ocf_exit_reason "Volume group [$VOLUME] has devices missing.  Consider partial_activation=true to attempt to activate partially"
261ad6
+					exit $OCF_ERR_GENERIC
261ad6
+				else
261ad6
+					# We are missing devices but are allowed to activate partially. 
261ad6
+					# Assume that caused the vgck failure and carry on
261ad6
+					ocf_log warn "Volume group inconsistency detected with missing device(s) and partial_activation enabled.  Proceeding with requested action."
261ad6
+				fi
261ad6
+			fi
261ad6
+			# else the vg is partial but all devices are accounted for, so another 
261ad6
+			# node must have marked the device missing.  Proceed.
261ad6
+		else
261ad6
+			# vgck failure was for something other than missing devices
261ad6
+			ocf_exit_reason "Volume group [$VOLUME] does not exist or contains error! ${VGOUT}"
261ad6
+			exit $OCF_ERR_GENERIC
261ad6
+		fi
261ad6
 	fi
261ad6
 
261ad6
 	##
261ad6
-- 
261ad6
1.8.4.2
261ad6