Blame 0020-multipath-need_shutdown-if-multipath-devices-exist.patch

Harald Hoyer f8c4a0
From e84d115b93428bf93e82a2c808721aadc048b163 Mon Sep 17 00:00:00 2001
Harald Hoyer f8c4a0
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer f8c4a0
Date: Fri, 9 Aug 2013 10:44:34 +0200
Harald Hoyer f8c4a0
Subject: [PATCH] multipath: need_shutdown if multipath devices exist
Harald Hoyer f8c4a0
Harald Hoyer f8c4a0
https://bugzilla.redhat.com/show_bug.cgi?id=994913
Harald Hoyer f8c4a0
---
Harald Hoyer f8c4a0
 modules.d/90multipath/module-setup.sh            | 3 +++
Harald Hoyer f8c4a0
 modules.d/90multipath/multipathd-needshutdown.sh | 9 +++++++++
Harald Hoyer f8c4a0
 2 files changed, 12 insertions(+)
Harald Hoyer f8c4a0
 create mode 100755 modules.d/90multipath/multipathd-needshutdown.sh
Harald Hoyer f8c4a0
Harald Hoyer f8c4a0
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
Harald Hoyer f8c4a0
index 6cdc511..feb58dc 100755
Harald Hoyer f8c4a0
--- a/modules.d/90multipath/module-setup.sh
Harald Hoyer f8c4a0
+++ b/modules.d/90multipath/module-setup.sh
Harald Hoyer f8c4a0
@@ -95,6 +95,9 @@ install() {
Harald Hoyer f8c4a0
         inst_hook pre-trigger 02 "$moddir/multipathd.sh"
Harald Hoyer f8c4a0
         inst_hook cleanup   02 "$moddir/multipathd-stop.sh"
Harald Hoyer f8c4a0
     fi
Harald Hoyer f8c4a0
+
Harald Hoyer f8c4a0
+    inst_hook cleanup   80 "$moddir/multipathd-needshutdown.sh"
Harald Hoyer f8c4a0
+
Harald Hoyer f8c4a0
     inst_rules 40-multipath.rules 62-multipath.rules 65-multipath.rules 66-kpartx.rules
Harald Hoyer f8c4a0
 }
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
diff --git a/modules.d/90multipath/multipathd-needshutdown.sh b/modules.d/90multipath/multipathd-needshutdown.sh
Harald Hoyer f8c4a0
new file mode 100755
Harald Hoyer f8c4a0
index 0000000..1565d4d
Harald Hoyer f8c4a0
--- /dev/null
Harald Hoyer f8c4a0
+++ b/modules.d/90multipath/multipathd-needshutdown.sh
Harald Hoyer f8c4a0
@@ -0,0 +1,9 @@
Harald Hoyer f8c4a0
+#!/bin/sh
Harald Hoyer f8c4a0
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
Harald Hoyer f8c4a0
+# ex: ts=8 sw=4 sts=4 et filetype=sh
Harald Hoyer f8c4a0
+
Harald Hoyer f8c4a0
+for i in /dev/mapper/mpath*; do
Harald Hoyer f8c4a0
+    [ -b "$i" ] || continue
Harald Hoyer f8c4a0
+    need_shutdown
Harald Hoyer f8c4a0
+    break
Harald Hoyer f8c4a0
+done