device-mapper-multipath/mpath_wait.patch
Benjamin Marzinski c7ea1a3b8d Updated to latest upstream 0.4.9 code : multipath-tools-090729.tgz (git
commit id: d678c139719d5631194b50e49f16ca97162ecd0f) moved multipath
    bindings file from /var/lib/multipath to /etc/multipath Fixed 354961,
    432520
2009-07-29 22:54:07 +00:00

49 lines
1.5 KiB
Diff

---
multipath/Makefile | 3 ++-
multipath/mpath_wait | 17 +++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
Index: multipath-tools-090724/multipath/Makefile
===================================================================
--- multipath-tools-090724.orig/multipath/Makefile
+++ multipath-tools-090724/multipath/Makefile
@@ -20,7 +20,7 @@ $(EXEC): $(OBJS)
install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
- $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
+ $(INSTALL_PROGRAM) -m 755 $(EXEC) mpath_wait $(DESTDIR)$(bindir)/
$(INSTALL_PROGRAM) -d $(DESTDIR)/etc/udev/rules.d
$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/etc/udev/rules.d/
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
@@ -34,6 +34,7 @@ install:
uninstall:
rm $(DESTDIR)/etc/udev/rules.d/multipath.rules
rm $(DESTDIR)$(bindir)/$(EXEC)
+ rm $(DESTDIR)$(bindir)/mpath_wait
rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
Index: multipath-tools-090724/multipath/mpath_wait
===================================================================
--- /dev/null
+++ multipath-tools-090724/multipath/mpath_wait
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+retry=3
+sec=1
+
+/sbin/dmsetup info -c --noheadings -j $1 -m $2 2> /dev/null | grep -q .*:${1}:${2}:L.*:.*:.*:.*:.*
+ret=$?
+
+while [ "$ret" -ne 0 -a "$retry" -gt 0 ]
+do
+ sleep $sec
+ /sbin/dmsetup info -c --noheadings -j $1 -m $2 2> /dev/null | grep -q .*:${1}:${2}:L.*:.*:.*:.*:.*
+ ret=$?
+ retry=$(($retry - 1))
+done
+
+exit $ret