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

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