d7527d7d2dc4660eff3cc670733fcddb59dd6d21
[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 # DM_SUBSYSTEM_UDEV_FLAG1 is the "skip_kpartx" flag.
16 # For events not generated by libdevmapper, we need to fetch it from db:
17 # - "change" events with DM_ACTIVATION!="1" (e.g. partition table changes)
18 # - "add" events for which rules are not disabled ("coldplug" case)
19 ENV{DM_ACTIVATION}!="1", IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1"
20 ACTION=="add", IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1"
21 ENV{DM_SUBSYSTEM_UDEV_FLAG1}=="1", GOTO="mpath_kpartx_end"
22
23 # 11-dm-mpath.rules sets MPATH_UNCHANGED for events that can be ignored.
24 ENV{MPATH_UNCHANGED}=="1", GOTO="mpath_kpartx_end"
25
26 # Don't run kpartx now if we know it will fail or hang.
27 ENV{DM_SUSPENDED}=="1", GOTO="mpath_kpartx_end"
28 ENV{DM_NOSCAN}=="1", GOTO="mpath_kpartx_end"
29
30 # Run kpartx
31 GOTO="run_kpartx"
32 LABEL="mpath_kpartx_end"
33
34 ## Code for other subsystems (non-multipath) could be placed here ##
35
36 GOTO="kpartx_end"
37
38 LABEL="run_kpartx"
39 RUN+="/sbin/kpartx -un -p -part /dev/$name"
40
41 LABEL="kpartx_end"