Add multipath rules for systemd support
authorHannes Reinecke <hare@suse.de>
Wed, 26 Feb 2014 13:36:43 +0000 (14:36 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Sun, 29 Mar 2015 15:42:17 +0000 (17:42 +0200)
Systemd and dracut rely on the DM_MULTIPATH_DEVICE_PATH setting
to mark the devices as used by multipathing. So add a ruleset
providing this setting.

Signed-off-by: Hannes Reinecke <hare@suse.de>
multipath/Makefile
multipath/multipath.rules [new file with mode: 0644]

index e295676..9f2e963 100644 (file)
@@ -23,6 +23,7 @@ install:
        $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
        $(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir)
        $(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir)
+       $(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(libudevdir)/rules.d/40-multipath.rules
        $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
        $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
        $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
@@ -31,6 +32,7 @@ install:
 uninstall:
        rm $(DESTDIR)$(bindir)/$(EXEC)
        rm $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules
+       rm $(DESTDIR)$(libudevdir)/rules.d/40-multipath.rules
        rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
        rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
 
diff --git a/multipath/multipath.rules b/multipath/multipath.rules
new file mode 100644 (file)
index 0000000..799fbb0
--- /dev/null
@@ -0,0 +1,13 @@
+# Set DM_MULTIPATH_DEVICE_PATH if the device should be handled by multipath
+SUBSYSTEM!="block", GOTO="end_mpath"
+
+ENV{MPATH_SBIN_PATH}="/sbin"
+TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
+
+SUBSYSTEM=="block", ACTION=="add|change", KERNEL!="dm-*", \
+       ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \
+       PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -v 0 -c $tempnode", \
+       ENV{DM_MULTIPATH_DEVICE_PATH}="1" \
+       ENV{SYSTEMD_READY}="0"
+
+LABEL="end_mpath"