Blame SOURCES/bz1667414-2-LVM-activate-only-count-volumes.patch

b4b3ce
From ee9a47f97dd8b0cb51033db7879a79588aab409c Mon Sep 17 00:00:00 2001
b4b3ce
From: Valentin Vidic <Valentin.Vidic@CARNet.hr>
b4b3ce
Date: Tue, 15 Jan 2019 15:40:01 +0100
b4b3ce
Subject: [PATCH] LVM-activate: fix dmsetup check
b4b3ce
b4b3ce
When there are no devices in the system dmsetup outputs one line:
b4b3ce
b4b3ce
  # dmsetup info -c
b4b3ce
  No devices found
b4b3ce
---
b4b3ce
 heartbeat/LVM-activate | 4 ++--
b4b3ce
 1 file changed, 2 insertions(+), 2 deletions(-)
b4b3ce
b4b3ce
diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
b4b3ce
index f46932c1c..c3225e1cb 100755
b4b3ce
--- a/heartbeat/LVM-activate
b4b3ce
+++ b/heartbeat/LVM-activate
b4b3ce
@@ -715,9 +715,9 @@ lvm_status() {
b4b3ce
 	if [ -n "${LV}" ]; then
b4b3ce
 		# dmsetup ls? It cannot accept device name. It's
b4b3ce
 		# too heavy to list all DM devices.
b4b3ce
-		dm_count=$(dmsetup info --noheadings --noflush -c -S "vgname=${VG} && lvname=${LV}" |  wc -l )
b4b3ce
+		dm_count=$(dmsetup info --noheadings --noflush -c -S "vgname=${VG} && lvname=${LV}" | grep -c -v '^No devices found')
b4b3ce
 	else
b4b3ce
-		dm_count=$(dmsetup info --noheadings --noflush -c -S "vgname=${VG}" 2>/dev/null | wc -l )
b4b3ce
+		dm_count=$(dmsetup info --noheadings --noflush -c -S "vgname=${VG}" | grep -c -v '^No devices found')
b4b3ce
 	fi
b4b3ce
 
b4b3ce
 	if [ $dm_count -eq 0 ]; then