cluster: RHEL510 - HA LVM should only remove missing PVs on stop when they belong to mirrors

Ryan McCabe rmccabe at fedoraproject.org
Tue May 21 03:47:00 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=d45a4fe2fa265a19a4130161caa4ce92367f9072
Commit:        d45a4fe2fa265a19a4130161caa4ce92367f9072
Parent:        1d7a0335016cae0246f455a707f78bfc5d1ff880
Author:        John Ruemker <jruemker at redhat.com>
AuthorDate:    Tue May 14 15:19:19 2013 -0500
Committer:     Ryan McCabe <rmccabe at redhat.com>
CommitterDate: Mon May 20 23:46:49 2013 -0400

HA LVM should only remove missing PVs on stop when they belong to mirrors

This adds --mirrorsonly to the 3 'vgreduce --removemissing' calls in the
LVM agents.

You'll also notice that it adds another self_fence check after we fail to
remove tags.  In my previous comment, I pointed out that in the case of
single-host by_lv, after we vgreduce we then can't deactivate the logical
volume again because it doesn't exist.  This results in us executing
self_fence, which may have just been a happy accident.  But when we avoid
making metadata changes by adding --mirrorsonly, the subsequent deactivation
is still successful, and thus we miss the self_fence logic.  So, I added
another check so we still catch the failure and fence ourselves in this
situation.

Resolves: rhbz#962376

Signed-off-by: John Ruemker <jruemker at redhat.com>
Signed-off-by: Jonthan Brassow <jbrassow at redhat.com>
Signed-off-by: Ryan McCabe <rmccabe at redhat.com>
---
 rgmanager/src/resources/lvm_by_lv.sh |   14 ++++++++++----
 rgmanager/src/resources/lvm_by_vg.sh |    4 ++--
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/rgmanager/src/resources/lvm_by_lv.sh b/rgmanager/src/resources/lvm_by_lv.sh
index 4971173..7140076 100644
--- a/rgmanager/src/resources/lvm_by_lv.sh
+++ b/rgmanager/src/resources/lvm_by_lv.sh
@@ -243,13 +243,19 @@ lv_activate_and_tag()
 			# be removed from the VG via a separate call before
 			# the tag can be removed.
 			ocf_log err "Attempting volume group clean-up and retry"
-			vgreduce --removemissing --force $OCF_RESKEY_vg_name
+			vgreduce --removemissing --mirrorsonly --force $OCF_RESKEY_vg_name
 
 			# Retry tag deletion
 			lvchange --deltag $tag $lv_path
 			if [ $? -ne 0 ]; then
-				ocf_log err "Failed to delete tag from $lv_path"
-				return $OCF_ERR_GENERIC
+	                        if [ "$self_fence" ]; then
+	                                ocf_log err "Failed to delete tag from $lv_path: REBOOTING"
+                	                sync
+                        	        reboot -fn
+	                        else
+	                                ocf_log err "Failed to delete tag from $lv_path"
+                	        fi
+                        	return $OCF_ERR_GENERIC
 			fi
 		fi
 
@@ -322,7 +328,7 @@ lv_activate()
 
 		ocf_log notice "Attempting cleanup of $OCF_RESKEY_vg_name"
 
-		if vgreduce --removemissing --force --config \
+		if vgreduce --removemissing --mirrorsonly --force --config \
 		    "activation { volume_list = \"$OCF_RESKEY_vg_name\" }" \
 		    $OCF_RESKEY_vg_name; then
 			ocf_log notice "$OCF_RESKEY_vg_name now consistent"
diff --git a/rgmanager/src/resources/lvm_by_vg.sh b/rgmanager/src/resources/lvm_by_vg.sh
index 0dd2aaa..819d0b8 100755
--- a/rgmanager/src/resources/lvm_by_vg.sh
+++ b/rgmanager/src/resources/lvm_by_vg.sh
@@ -202,7 +202,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 --force $OCF_RESKEY_vg_name; then
+		if ! vgreduce --removemissing --mirrorsonly --force $OCF_RESKEY_vg_name; then
 			ocf_log err "Failed to make $OCF_RESKEY_vg_name consistent"
 			return $OCF_ERR_GENERIC
 		fi
@@ -398,7 +398,7 @@ function vg_stop_single
 
 	#  Shut down the volume group
 	#  Do we need to make this resilient?
-	vgchange -an $OCF_RESKEY_vg_name
+	vgchange -aln $OCF_RESKEY_vg_name
 
 	#  Make sure all the logical volumes are inactive
 	results=(`lvs -o name,attr --noheadings $OCF_RESKEY_vg_name 2> /dev/null`)


More information about the cluster-commits mailing list