integ/base/cluster-resource-agents/centos/patches/Fix-VG-activity-bug-in-heartbeat-LVM-script.patch
Scott Little dad45a06a5 Relocate cluster-resource-agents to
stx-integ/base/cluster-resource-agents

Move content from stx-gplv2 into stx-integ

Packages will be relocated to

stx-integ:
    base/
        bash
        cgcs-users
        cluster-resource-agents
        dpkg
        haproxy
        libfdt
        netpbm
        rpm

    database/
        mariadb

    filesystem/
        iscsi-initiator-utils

    filesystem/drbd/
        drbd-tools

    kernel/kernel-modules/
        drbd
        integrity
        intel-e1000e
        intel-i40e
        intel-i40evf
        intel-ixgbe
        intel-ixgbevf
        qat17
        tpmdd

    ldap/
        ldapscripts

    networking/
        iptables
        net-tools

Change-Id: I3a4ee4bde0adfd2a486bd5be3a151db85aa4947e
Story: 2002801
Task: 22687
Signed-off-by: Scott Little <scott.little@windriver.com>
2018-08-01 15:31:54 -04:00

59 lines
2.1 KiB
Diff

From 98591b479bd64c2835ab1e8884118c57dd499b9c Mon Sep 17 00:00:00 2001
From: Chris Friesen <chris.friesen@windriver.com>
Date: Tue, 21 Jun 2016 14:29:36 -0400
Subject: [PATCH] Fix VG activity bug in heartbeat/LVM script
There is currently an issue in the lvm2 package where if you create an LVM thin
pool, then create a thin volume in the pool, then the udev rule doesn't think
there should be a /dev// symlink for the thin pool, but "vgmknodes" and
"vgscan --mknodes" both think that there should be such a symlink. This is a
bug, but it's in the field in CentOS 7 at least and likely elsewhere.
The end result of this is that on such a system running either "vgscan
--mknodes" or "vgmknodes" and then running "vgchange -an " will
leave the /dev/ directory with a dangling symlink in it.
This breaks the LVM_status() function in this OCF script, since the
/dev/ directory exists and is not empty even though the volume
group is not active.
This commit changes the code to directly query lvm about the volume group
activity rather than relying on side effects.
---
heartbeat/LVM | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/heartbeat/LVM b/heartbeat/LVM
index 1c23c05..d91a3bc 100755
--- a/heartbeat/LVM
+++ b/heartbeat/LVM
@@ -350,19 +350,16 @@ LVM_status() {
ocf_exit_reason "LVM Volume $1 is not available"
return $OCF_ERR_GENERIC
fi
-
- if [ -d /dev/$1 ]; then
- test "`cd /dev/$1 && ls`" != ""
- rc=$?
- if [ $rc -ne 0 ]; then
- ocf_exit_reason "VG $1 with no logical volumes is not supported by this RA!"
- fi
- fi
- if [ $rc -ne 0 ]; then
+ # Ask lvm whether the volume group is active. This maps to
+ # the question "Are there any logical volumes that are active in
+ # the specified volume group?".
+ lvs --noheadings -o selected -S lv_active=active,vg_name=${1}|grep -q 1
+ if [ $? -ne 0 ]; then
ocf_log $loglevel "LVM Volume $1 is not available (stopped)"
rc=$OCF_NOT_RUNNING
else
+ rc=0
case $(get_vg_mode) in
1) # exclusive with tagging.
# If vg is running, make sure the correct tag is present. Otherwise we
--
1.9.1