File 0022-Medium-Raid1-Ignore-transient-devices-after-stopping.patch of Package resource-agents.10310

From f8384f0afaa280395fcc8688b1e73b85434f25d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@suse.com>
Date: Tue, 30 Jan 2018 12:01:53 +0100
Subject: [PATCH 22/22] Medium: Raid1: Ignore transient devices after stopping
 a device (bsc#1077416)

There may be a transient invalid device after we stop the MD due to
other programs processing uevent, the original device is stopped though
(`mdadm --stop` only returns when MD is stopped).

The idea suggested by Neil Brown <nfbrown@suse.com>.
---
 heartbeat/Raid1 | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/heartbeat/Raid1 b/heartbeat/Raid1
index de7e0598..ca96b36b 100755
--- a/heartbeat/Raid1
+++ b/heartbeat/Raid1
@@ -384,8 +384,16 @@ raid1_monitor_one() {
 		2)	ocf_exit_reason "$mddev has failed."
 			return $OCF_ERR_GENERIC
 			;;
-		4)	ocf_exit_reason "mdadm failed on $mddev."
-			return $OCF_ERR_GENERIC
+		4)
+			if [ "$__OCF_ACTION" = "stop" ] ; then
+				# There may be a transient invalid device after
+				# we stop MD due to uevent processing, the
+				# original device is stopped though.
+				return $OCF_NOT_RUNNING
+			else
+				ocf_exit_reason "mdadm failed on $mddev."
+				return $OCF_ERR_GENERIC
+			fi
 			;;
 		*)	ocf_exit_reason "mdadm returned an unknown result ($rc)."
 			return $OCF_ERR_GENERIC
-- 
2.15.1

openSUSE Build Service is sponsored by