cluster: RHEL6 - Fix bug 683213 - mirror dev failure in HA LVM can cause service failure

Jonathan Brassow jbrassow at fedoraproject.org
Wed Apr 6 16:36:29 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=fe9bef6e01c83e87bee845caa6d763deb33da431
Commit:        fe9bef6e01c83e87bee845caa6d763deb33da431
Parent:        e51fbc090cb3b7a343aae3ff7d1ffcd94f7fbb5b
Author:        Jonathan Brassow <jbrassow at f14.(none)>
AuthorDate:    Wed Apr 6 11:23:29 2011 -0500
Committer:     Jonathan Brassow <jbrassow at redhat.com>
CommitterDate: Wed Apr 6 11:36:11 2011 -0500

Fix bug 683213 - mirror dev failure in HA LVM can cause service failure

A new option was added to 'vgreduce', --force.  This argument is now
required.

Additionally, repair is attempted when deactivating a device as well as
when trying to activate.  This is because a shutdown of a service can
race against a device failure.  Adding the repair option to the shutdown
process adds resilience.
---
 rgmanager/src/resources/lvm_by_lv.sh |   63 +++++++++++++++------------------
 rgmanager/src/resources/lvm_by_vg.sh |    4 +-
 2 files changed, 31 insertions(+), 36 deletions(-)

diff --git a/rgmanager/src/resources/lvm_by_lv.sh b/rgmanager/src/resources/lvm_by_lv.sh
index 759062a..4aead58 100644
--- a/rgmanager/src/resources/lvm_by_lv.sh
+++ b/rgmanager/src/resources/lvm_by_lv.sh
@@ -289,45 +289,40 @@ lv_activate()
 	if ! lv_activate_and_tag $1 $my_name $lv_path; then
 		ocf_log err "Failed to $1 $lv_path"
 
-		if [ "$1" == "start" ]; then
-			ocf_log notice "Attempting cleanup of $OCF_RESKEY_vg_name"
-
-			if vgreduce --removemissing --config \
-			    "activation { volume_list = \"$OCF_RESKEY_vg_name\" }" \
-			    $OCF_RESKEY_vg_name; then
-				ocf_log notice "$OCF_RESKEY_vg_name now consistent"
-				owner=`lvs -o tags --noheadings $lv_path`
-				if [ ! -z $owner ] && [ $owner != $my_name ]; then
-					if is_node_member_clustat $owner ; then
-						ocf_log err "$owner owns $lv_path unable to $1"
-						return $OCF_ERR_GENERIC
-					fi
-					ocf_log notice "Owner of $lv_path is not in the cluster"
-					ocf_log notice "Stealing $lv_path"
-
-					lvchange --deltag $owner $lv_path
-					if [ $? -ne 0 ]; then
-						ocf_log err "Failed to steal $lv_path from $owner"
-						return $OCF_ERR_GENERIC
-					fi
-
-					# Warning --deltag doesn't always result in failure
-					if [ ! -z `lvs -o tags --noheadings $lv_path` ]; then
-						ocf_log err "Failed to steal $lv_path from $owner."
-						return $OCF_ERR_GENERIC
-					fi
+		ocf_log notice "Attempting cleanup of $OCF_RESKEY_vg_name"
+
+		if vgreduce --removemissing --force --config \
+		    "activation { volume_list = \"$OCF_RESKEY_vg_name\" }" \
+		    $OCF_RESKEY_vg_name; then
+			ocf_log notice "$OCF_RESKEY_vg_name now consistent"
+			owner=`lvs -o tags --noheadings $lv_path`
+			if [ ! -z $owner ] && [ $owner != $my_name ]; then
+				if is_node_member_clustat $owner ; then
+					ocf_log err "$owner owns $lv_path unable to $1"
+					return $OCF_ERR_GENERIC
 				fi
+				ocf_log notice "Owner of $lv_path is not in the cluster"
+				ocf_log notice "Stealing $lv_path"
 
-				if ! lv_activate_and_tag $1 $my_name $lv_path; then
-					ocf_log err "Failed second attempt to $1 $lv_path"
+				lvchange --deltag $owner $lv_path
+				if [ $? -ne 0 ]; then
+					ocf_log err "Failed to steal $lv_path from $owner"
 					return $OCF_ERR_GENERIC
-				else
-					ocf_log notice "Second attempt to $1 $lv_path successful"
-					return $OCF_SUCCESS
 				fi
-			else
-				ocf_log err "Failed to make $OCF_RESKEY_vg_name consistent"
+
+				# Warning --deltag doesn't always result in failure
+				if [ ! -z `lvs -o tags --noheadings $lv_path` ]; then
+					ocf_log err "Failed to steal $lv_path from $owner."
+					return $OCF_ERR_GENERIC
+				fi
+			fi
+
+			if ! lv_activate_and_tag $1 $my_name $lv_path; then
+				ocf_log err "Failed second attempt to $1 $lv_path"
 				return $OCF_ERR_GENERIC
+			else
+				ocf_log notice "Second attempt to $1 $lv_path successful"
+				return $OCF_SUCCESS
 			fi
 		else
 			ocf_log err "Failed to $1 $lv_path"
diff --git a/rgmanager/src/resources/lvm_by_vg.sh b/rgmanager/src/resources/lvm_by_vg.sh
index f0ca671..2cce7c9 100644
--- a/rgmanager/src/resources/lvm_by_vg.sh
+++ b/rgmanager/src/resources/lvm_by_vg.sh
@@ -160,7 +160,7 @@ function vg_start_clustered
 		ocf_log err "Failed to activate volume group, $OCF_RESKEY_vg_name"
 		ocf_log notice "Attempting cleanup of $OCF_RESKEY_vg_name"
 
-		if ! vgreduce --removemissing $OCF_RESKEY_vg_name; then
+		if ! vgreduce --removemissing --force $OCF_RESKEY_vg_name; then
 			ocf_log err "Failed to make $OCF_RESKEY_vg_name consistent"
 			return $OCF_ERR_GENERIC
 		fi
@@ -238,7 +238,7 @@ function vg_start_single
 		ocf_log err "Failed to activate volume group, $OCF_RESKEY_vg_name"
 		ocf_log notice "Attempting cleanup of $OCF_RESKEY_vg_name"
 
-		if ! vgreduce --removemissing --config \
+		if ! vgreduce --removemissing --force --config \
 			"activation { volume_list = \"$OCF_RESKEY_vg_name\" }" \
 			$OCF_RESKEY_vg_name; then
 


More information about the cluster-commits mailing list