From 2cdd1c347088a8928416a73c390927c3765f3a59 Mon Sep 17 00:00:00 2001 From: bixiaoyan Date: Wed, 20 Jul 2022 17:14:04 +0800 Subject: [PATCH] Added depth testing for LVM --- LVM_OCF_CHECK_LEVEL.patch | 33 +++++++++++++++++++++++++++++++++ resource-agents.spec | 6 +++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 LVM_OCF_CHECK_LEVEL.patch diff --git a/LVM_OCF_CHECK_LEVEL.patch b/LVM_OCF_CHECK_LEVEL.patch new file mode 100644 index 0000000..5a0f999 --- /dev/null +++ b/LVM_OCF_CHECK_LEVEL.patch @@ -0,0 +1,33 @@ +diff --git a/heartbeat/LVM b/heartbeat/LVM +index d3cd1a1..0678b15 100755 +--- a/heartbeat/LVM ++++ b/heartbeat/LVM +@@ -187,6 +187,28 @@ LVM_status() { + fi + fi + ++ case "$OCF_CHECK_LEVEL" in ++ 0) ++ ;; ++ 10) ++ # if there are many lv in vg dir, pick the first name ++ dm_name="/dev/$1/$(ls -1 /dev/$1 | head -n 1)" ++ ++ # read 1 byte to check the dev is alive ++ dd if=${dm_name} of=/dev/null bs=1 count=1 >/dev/null \ ++ 2>&1 ++ if [ $? -ne 0 ]; then ++ return $OCF_NOT_RUNNING ++ else ++ return $OCF_SUCCESS ++ fi ++ ;; ++ *) ++ ocf_exit_reason "unsupported monitor level $OCF_CHECK_LEVEL" ++ return $OCF_ERR_CONFIGURED ++ ;; ++ esac ++ + if [ $rc -ne 0 ]; then + ocf_log $loglevel "LVM Volume $1 is not available (stopped)" + rc=$OCF_NOT_RUNNING diff --git a/resource-agents.spec b/resource-agents.spec index 9cafd43..e7d8f6b 100644 --- a/resource-agents.spec +++ b/resource-agents.spec @@ -1,10 +1,11 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.2.0 -Release: 3 +Release: 4 License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents Source0: https://github.com/ClusterLabs/resource-agents/archive/v4.2.0.tar.gz +Patch0: LVM_OCF_CHECK_LEVEL.patch Obsoletes: heartbeat-resources <= %{version} Provides: heartbeat-resources = %{version} BuildRequires: automake autoconf pkgconfig gcc perl-interpreter perl-generators python3-devel @@ -100,6 +101,9 @@ export CFLAGS="$(echo '%{optflags}')" %{_mandir}/man8/{ocf-tester.8*,ldirectord.8*} %changelog +* Wed Jul 20 2022 Bixiaoyan - 4.2.0-4 +- Add LVM_OCF_CHECK_LEVEL.patch + * Tue Oct 27 2020 Anan Fu - 4.2.0-3 - disable python2 -- Gitee