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

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