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