Imported Upstream version 0.8.9
[platform/upstream/multipath-tools.git] / kpartx / kpartx.rules
1 #
2 # persistent links for device-mapper devices
3 # only hardware-backed device-mapper devices (ie multipath, dmraid,
4 # and kpartx) have meaningful persistent device names
5 #
6
7 KERNEL!="dm-*", GOTO="kpartx_end"
8 ACTION!="add|change", GOTO="kpartx_end"
9 ENV{DM_UUID}!="?*", GOTO="kpartx_end"
10 ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="kpartx_end"
11
12 # Create dm tables for partitions on multipath devices.
13 ENV{DM_UUID}!="mpath-?*", GOTO="mpath_kpartx_end"
14
15 # Ignore RAID members
16 ENV{ID_FS_TYPE}=="linux_raid_member|isw_raid_member|ddf_raid_member", GOTO="mpath_kpartx_end"
17
18 # DM_SUBSYSTEM_UDEV_FLAG1 is the "skip_kpartx" flag.
19 # For events not generated by libdevmapper, we need to fetch it from db:
20 # - "change" events with DM_ACTIVATION!="1" (e.g. partition table changes)
21 # - "add" events for which rules are not disabled ("coldplug" case)
22 ENV{DM_ACTIVATION}!="1", IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1"
23 ACTION=="add", IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1"
24 ENV{DM_SUBSYSTEM_UDEV_FLAG1}=="1", GOTO="mpath_kpartx_end"
25
26 # 11-dm-mpath.rules sets MPATH_UNCHANGED for events that can be ignored.
27 ENV{MPATH_UNCHANGED}=="1", GOTO="mpath_kpartx_end"
28
29 # Don't run kpartx now if we know it will fail or hang.
30 ENV{DM_SUSPENDED}=="1", GOTO="mpath_kpartx_end"
31 ENV{DM_NOSCAN}=="1", GOTO="mpath_kpartx_end"
32
33 # Run kpartx
34 GOTO="run_kpartx"
35 LABEL="mpath_kpartx_end"
36
37 ## Code for other subsystems (non-multipath) could be placed here ##
38
39 GOTO="kpartx_end"
40
41 LABEL="run_kpartx"
42 RUN+="/sbin/kpartx -un -p -part /dev/$name"
43
44 LABEL="kpartx_end"