Skip to content
Browse files

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

…rors

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.

J.B - Retain the loop in 'vg_stop_clustered' that waits for udev to settle
      when trying to deactivate the volume group.  Failure to do so can
      lead to failure to deactivate the volume group.

Signed-off-by: John Ruemker <jruemker@redhat.com>
Signed-off-by: Jonthan Brassow <jbrassow@redhat.com>
  • Loading branch information...
1 parent a00878d commit 1c7e30b5bb93ba886dbf60bf9d5cf781f73815fa @johnruemker johnruemker committed with May 14, 2013
Showing with 11 additions and 5 deletions.
  1. +10 −4 rgmanager/src/resources/lvm_by_lv.sh
  2. +1 −1 rgmanager/src/resources/lvm_by_vg.sh
View
14 rgmanager/src/resources/lvm_by_lv.sh
@@ -269,13 +269,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
@@ -355,7 +361,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"
View
2 rgmanager/src/resources/lvm_by_vg.sh
@@ -229,7 +229,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

0 comments on commit 1c7e30b

Please sign in to comment.
Something went wrong with that request. Please try again.