multipath-tools: clean stealth whitespaces for the rest
[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=="remove", GOTO="kpartx_end"
9
10 ENV{DM_TABLE_STATE}!="LIVE", GOTO="kpartx_end"
11 ENV{DM_DEPS}=="0", GOTO="kpartx_end"
12
13 ENV{DM_UUID}=="?*", IMPORT{program}=="kpartx_id %M %m $env{DM_UUID}"
14
15 OPTIONS="link_priority=50"
16
17 ENV{DM_UUID}=="?*", ENV{DM_TYPE}=="?*" \
18         SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
19
20 # Create persistent links for multipath tables
21 ENV{DM_WWN}=="?*", ENV{DM_PART}!="?*", \
22         SYMLINK+="disk/by-id/wwn-$env{DM_WWN}"
23
24 # Create persistent links for partitions
25 ENV{DM_WWN}=="?*", ENV{DM_PART}=="?*", \
26         SYMLINK+="disk/by-id/wwn-$env{DM_WWN}-part$env{DM_PART}"
27
28 # Create persistent by-label/by-uuid links
29 ENV{ID_FS_USAGE}=="?*", IMPORT{db}="ID_FS_USAGE"
30 ENV{ID_FS_UUID_ENC}=="?*", IMPORT{db}="ID_FS_UUID_ENC"
31 ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", \
32         SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
33 ENV{ID_FS_LABEL_ENC}=="?*", IMPORT{db}="ID_FS_LABEL_ENC"
34 ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", \
35         SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
36
37 # Create dm tables for partitions
38 ENV{DM_ACTION}=="PATH_FAILED|PATH_REINSTATED", GOTO="kpartx_end"
39 ENV{DM_NR_VALID_PATHS}=="0", GOTO="kpartx_end"
40 ENV{DM_STATE}!="SUSPENDED", ENV{DM_UUID}=="mpath-*", \
41         RUN+="/sbin/kpartx -u -p -part /dev/$name"
42
43 LABEL="kpartx_end"