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

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