File 0001-LVM-activate-Disable-VG-autoactivation-in-system_id-.patch of Package resource-agents.23108
From 8522aab2d0d59effb85f303ff2db313c88e00f36 Mon Sep 17 00:00:00 2001
From: Gang He <ghe@suse.com>
Date: Thu, 29 Apr 2021 10:20:26 +0800
Subject: [PATCH 1/1] LVM-activate: Disable VG autoactivation in system_id
access_mode
The autoactivation property of volume group will be disabled when
vg_access_mode is set to system_id, to fix HA-LVM systemid race
condition, which introduces an error "active on 2 nodes".
For HA-LVM systemid use case, the node might introduce the
unexpected outage of the cluster service. In details, the node
might suffer from some race condition and reports "active on 2 nodes"
on one node after reset the active node. This will cause the active
service to be restarted which is unexpected.
---
heartbeat/LVM-activate | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
index 8a01b648..a8e40dce 100755
--- a/heartbeat/LVM-activate
+++ b/heartbeat/LVM-activate
@@ -115,6 +115,9 @@
the stop action of the lvmlockd agent may fail and the node may get fenced,
because some DLM lockspaces might be in use and cannot be closed automatically.
+3. The autoactivation property of volume group will be disabled when vg_access_mode
+is set to system_id.
+
Option: OCF_CHECK_LEVEL
The standard monitor operation of depth 0 checks if the VG or LV is valid.
@@ -678,12 +681,21 @@
systemid_activate() {
local cur_systemid
+ set_autoactivation=0
cur_systemid=$(vgs --foreign --noheadings -o systemid ${VG} | tr -d '[:blank:]')
# Put our system ID on the VG
vgchange -y --config "local/extra_system_ids=[\"${cur_systemid}\"]" \
--systemid ${SYSTEM_ID} ${VG}
+ vgchange --help | grep '\--setautoactivation' >/dev/null 2>&1 && set_autoactivation=1
+
+ if [ $set_autoactivation -ne 0 ]; then
+ if vgs -o autoactivation ${VG} | grep enabled >/dev/null 2>&1 ; then
+ ocf_log info "disable the autoactivation property of ${VG}"
+ ocf_run vgchange --setautoactivation n ${VG}
+ fi
+ fi
do_activate "-ay"
if [ $? -ne $OCF_SUCCESS ]; then