|
|
b94b9d |
From 2c219dd000d7f5edd3765a1c6bc5f3e6efb7208b Mon Sep 17 00:00:00 2001
|
|
|
b94b9d |
From: Paul Mezzanini <pfmeec@rit.edu>
|
|
|
b94b9d |
Date: Fri, 1 Jun 2018 11:58:06 -0400
|
|
|
b94b9d |
Subject: [PATCH] Volume groups and logical volumes "-" in their name get
|
|
|
b94b9d |
mangled with double dashes in dmsetup. Switching to wc and just counting
|
|
|
b94b9d |
lines while depending on the vgname + lvname filter in the dmsetup call gets
|
|
|
b94b9d |
around the issue with dmsetup outputting correctly but grep failing due to
|
|
|
b94b9d |
the name mangle.
|
|
|
b94b9d |
|
|
|
b94b9d |
Logic for both test cases and dmsetup calls changed so they match too. No reason
|
|
|
b94b9d |
to not have matching tests.
|
|
|
b94b9d |
|
|
|
b94b9d |
This is AllBad but there isn't a better way that I'm aware of yet.
|
|
|
b94b9d |
---
|
|
|
b94b9d |
heartbeat/LVM-activate | 17 ++++++++++++-----
|
|
|
b94b9d |
1 file changed, 12 insertions(+), 5 deletions(-)
|
|
|
b94b9d |
|
|
|
b94b9d |
diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
|
|
|
b94b9d |
index 60e656178..fbd058288 100755
|
|
|
b94b9d |
--- a/heartbeat/LVM-activate
|
|
|
b94b9d |
+++ b/heartbeat/LVM-activate
|
|
|
b94b9d |
@@ -692,20 +692,27 @@ tagging_deactivate() {
|
|
|
b94b9d |
# lvs/vgs when the metadata is somehow inconsistent.
|
|
|
b94b9d |
#
|
|
|
b94b9d |
# So, we have to make compromise that the VG is assumably active if any LV of the VG is active.
|
|
|
b94b9d |
+#
|
|
|
b94b9d |
+# Paul:
|
|
|
b94b9d |
+# VGS + LVS with "-" in their name get mangled with double dashes in dmsetup.
|
|
|
b94b9d |
+# Switching to wc and just counting lines while depending on the vgname + lvname filter
|
|
|
b94b9d |
+# in dmsetup gets around the issue with dmsetup reporting correctly but grep failing.
|
|
|
b94b9d |
+#
|
|
|
b94b9d |
+# Logic for both test cases and dmsetup calls changed so they match too.
|
|
|
b94b9d |
+#
|
|
|
b94b9d |
+# This is AllBad but there isn't a better way that I'm aware of yet.
|
|
|
b94b9d |
lvm_status() {
|
|
|
b94b9d |
local dm_count
|
|
|
b94b9d |
|
|
|
b94b9d |
if [ -n "${LV}" ]; then
|
|
|
b94b9d |
# dmsetup ls? It cannot accept device name. It's
|
|
|
b94b9d |
# too heavy to list all DM devices.
|
|
|
b94b9d |
- dmsetup info --noheadings --noflush -c -S "vgname=${VG} && lvname=${LV}" \
|
|
|
b94b9d |
- | grep -Eq "${VG}-+${LV}"
|
|
|
b94b9d |
+ dm_count=$(dmsetup info --noheadings --noflush -c -S "vgname=${VG} && lvname=${LV}" | wc -l )
|
|
|
b94b9d |
else
|
|
|
b94b9d |
- dm_count=$(dmsetup --noheadings info -c -S "vgname=${VG}" 2>/dev/null | grep -c "${VG}-")
|
|
|
b94b9d |
- test $dm_count -gt 0
|
|
|
b94b9d |
+ dm_count=$(dmsetup info --noheadings --noflush -c -S "vgname=${VG}" 2>/dev/null | wc -l )
|
|
|
b94b9d |
fi
|
|
|
b94b9d |
|
|
|
b94b9d |
- if [ $? -ne 0 ]; then
|
|
|
b94b9d |
+ if [ $dm_count -eq 0 ]; then
|
|
|
b94b9d |
return $OCF_NOT_RUNNING
|
|
|
b94b9d |
fi
|
|
|
b94b9d |
|