Skip to content

Commit

Permalink
HA LVM should only remove missing PVs on stop when they belong to mir…
Browse files Browse the repository at this point in the history
…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
johnruemker authored and jbrassow committed Jun 17, 2013
1 parent a00878d commit 1c7e30b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions rgmanager/src/resources/lvm_by_lv.sh
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -269,13 +269,19 @@ lv_activate_and_tag()
# be removed from the VG via a separate call before # be removed from the VG via a separate call before
# the tag can be removed. # the tag can be removed.
ocf_log err "Attempting volume group clean-up and retry" 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 # Retry tag deletion
lvchange --deltag $tag $lv_path lvchange --deltag $tag $lv_path
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
ocf_log err "Failed to delete tag from $lv_path" if [ "$self_fence" ]; then
return $OCF_ERR_GENERIC 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
fi fi


Expand Down Expand Up @@ -355,7 +361,7 @@ lv_activate()


ocf_log notice "Attempting cleanup of $OCF_RESKEY_vg_name" 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\" }" \ "activation { volume_list = \"$OCF_RESKEY_vg_name\" }" \
$OCF_RESKEY_vg_name; then $OCF_RESKEY_vg_name; then
ocf_log notice "$OCF_RESKEY_vg_name now consistent" ocf_log notice "$OCF_RESKEY_vg_name now consistent"
Expand Down
2 changes: 1 addition & 1 deletion rgmanager/src/resources/lvm_by_vg.sh
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function vg_start_clustered
ocf_log err "Failed to activate volume group, $OCF_RESKEY_vg_name" ocf_log err "Failed to activate volume group, $OCF_RESKEY_vg_name"
ocf_log notice "Attempting cleanup of $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" ocf_log err "Failed to make $OCF_RESKEY_vg_name consistent"
return $OCF_ERR_GENERIC return $OCF_ERR_GENERIC
fi fi
Expand Down

0 comments on commit 1c7e30b

Please sign in to comment.