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