|
|
9cf66a |
diff -uNr a/heartbeat/LVM-activate b/heartbeat/LVM-activate
|
|
|
9cf66a |
--- a/heartbeat/LVM-activate 2019-10-08 12:10:11.755991580 +0200
|
|
|
9cf66a |
+++ b/heartbeat/LVM-activate 2019-10-08 12:14:38.388288176 +0200
|
|
|
9cf66a |
@@ -42,6 +42,11 @@
|
|
|
9cf66a |
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
|
|
9cf66a |
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
|
|
9cf66a |
|
|
|
9cf66a |
+# Parameter defaults
|
|
|
9cf66a |
+OCF_RESKEY_partial_activation_default="false"
|
|
|
9cf66a |
+
|
|
|
9cf66a |
+: ${OCF_RESKEY_partial_activation=${OCF_RESKEY_partial_activation_default}}
|
|
|
9cf66a |
+
|
|
|
9cf66a |
# If LV is given, only activate this named LV; otherwise, activate all
|
|
|
9cf66a |
# LVs in the named VG.
|
|
|
9cf66a |
VG=${OCF_RESKEY_vgname}
|
|
|
9cf66a |
@@ -150,6 +155,16 @@
|
|
|
9cf66a |
<content type="string" default="pacemaker" />
|
|
|
9cf66a |
</parameter>
|
|
|
9cf66a |
|
|
|
9cf66a |
+<parameter name="partial_activation" unique="0" required="0">
|
|
|
9cf66a |
+<longdesc lang="en">
|
|
|
9cf66a |
+If set, the volume group will be activated partially even with some
|
|
|
9cf66a |
+physical volumes missing. It helps to set to true when using mirrored
|
|
|
9cf66a |
+logical volumes.
|
|
|
9cf66a |
+</longdesc>
|
|
|
9cf66a |
+<shortdesc lang="en">Activate VG partially when missing PVs</shortdesc>
|
|
|
9cf66a |
+<content type="string" default="${OCF_RESKEY_partial_activation_default}" />
|
|
|
9cf66a |
+</parameter>
|
|
|
9cf66a |
+
|
|
|
9cf66a |
</parameters>
|
|
|
9cf66a |
|
|
|
9cf66a |
<actions>
|
|
|
9cf66a |
@@ -486,6 +501,25 @@
|
|
|
9cf66a |
exit $OCF_ERR_CONFIGURED
|
|
|
9cf66a |
fi
|
|
|
9cf66a |
|
|
|
9cf66a |
+ # Inconsistency might be due to missing physical volumes, which doesn't
|
|
|
9cf66a |
+ # automatically mean we should fail. If partial_activation=true then
|
|
|
9cf66a |
+ # we should let start try to handle it, or if no PVs are listed as
|
|
|
9cf66a |
+ # "unknown device" then another node may have marked a device missing
|
|
|
9cf66a |
+ # where we have access to all of them and can start without issue.
|
|
|
9cf66a |
+ case $(vgs -o attr --noheadings $VG | tr -d ' ') in
|
|
|
9cf66a |
+ ???p??*)
|
|
|
9cf66a |
+ if ! ocf_is_true "$OCF_RESKEY_partial_activation" ; then
|
|
|
9cf66a |
+ # We are missing devices and cannot activate partially
|
|
|
9cf66a |
+ ocf_exit_reason "Volume group [$VG] has devices missing. Consider partial_activation=true to attempt to activate partially"
|
|
|
9cf66a |
+ exit $OCF_ERR_GENERIC
|
|
|
9cf66a |
+ else
|
|
|
9cf66a |
+ # We are missing devices but are allowed to activate partially.
|
|
|
9cf66a |
+ # Assume that caused the vgck failure and carry on
|
|
|
9cf66a |
+ ocf_log warn "Volume group inconsistency detected with missing device(s) and partial_activation enabled. Proceeding with requested action."
|
|
|
9cf66a |
+ fi
|
|
|
9cf66a |
+ ;;
|
|
|
9cf66a |
+ esac
|
|
|
9cf66a |
+
|
|
|
9cf66a |
# Get the access mode from VG metadata and check if it matches the input
|
|
|
9cf66a |
# value. Skip to check "tagging" mode because there's no reliable way to
|
|
|
9cf66a |
# automatically check if "tagging" mode is being used.
|
|
|
9cf66a |
@@ -545,6 +579,10 @@
|
|
|
9cf66a |
do_activate() {
|
|
|
9cf66a |
local activate_opt=$1
|
|
|
9cf66a |
|
|
|
9cf66a |
+ if ocf_is_true "$OCF_RESKEY_partial_activation" ; then
|
|
|
9cf66a |
+ activate_opt="${activate_opt} --partial"
|
|
|
9cf66a |
+ fi
|
|
|
9cf66a |
+
|
|
|
9cf66a |
# Only activate the specific LV if it's given
|
|
|
9cf66a |
if [ -n "$LV" ]; then
|
|
|
9cf66a |
ocf_run lvchange $activate_opt ${VG}/${LV}
|