70-yali.rules 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # If $YALI isn't set in the environment, skip all these rules.
  2. #ENV{YALI}!="?*", GOTO="yali_end"
  3. ACTION!="add|change", GOTO="yali_end"
  4. SUBSYSTEM!="block", GOTO="yali_end"
  5. # for device-mapper device we are supposed to only operate on "change" events
  6. KERNEL=="dm-*", ACTION=="add", GOTO="yali_end"
  7. KERNEL=="dm-*", ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="yali_end"
  8. KERNEL=="dm-*", ENV{DM_NAME}!="?*", GOTO="yali_end"
  9. KERNEL=="dm-*", ENV{DM_SUSPENDED}=="1", GOTO="yali_end"
  10. KERNEL=="dm-*", ENV{DM_SUSPENDED}=="Suspended", GOTO="yali_end"
  11. IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
  12. LABEL="yali_mdraid"
  13. KERNEL!="md*", GOTO="yali_mdraid_member"
  14. # container devices have a metadata version of e.g. 'external:ddf' and
  15. # never leave state 'inactive'
  16. ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
  17. TEST!="md/array_state", GOTO="yali_mdraid_member"
  18. ATTR{md/array_state}=="|clear|inactive", GOTO="yali_mdraid_member"
  19. LABEL="md_ignore_state"
  20. IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
  21. ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace"
  22. ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}"
  23. ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}"
  24. ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace"
  25. ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n"
  26. ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n"
  27. ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n"
  28. OPTIONS+="link_priority=100"
  29. OPTIONS+="watch"
  30. ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
  31. ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
  32. LABEL="yali_mdraid_member"
  33. # probe raid metadata of mdraid member devices
  34. ENV{ID_FS_TYPE}=="linux_raid_member", IMPORT{program}="/sbin/mdadm --examine --export $tempnode"
  35. ENV{ID_FS_TYPE}=="isw_raid_member", IMPORT{program}="/sbin/mdadm --examine --export $tempnode"
  36. # probe metadata of LVM2 physical volumes
  37. ENV{ID_FS_TYPE}=="LVM2_member", IMPORT{program}="/usr/sbin/lvm pvs --ignorelockingfailure --units k --nosuffix --nameprefixes --rows --unquoted --noheadings -opv_name,pv_uuid,pv_size,vg_name,vg_uuid,pv_pe_count,pv_pe_alloc_count,pe_start $tempnode"
  38. ENV{LVM2_VG_NAME}!="?*", GOTO="yali_end"
  39. ENV{ID_FS_TYPE}=="LVM2_member", IMPORT{program}="/usr/sbin/lvm vgs --ignorelockingfailure --units k --nosuffix --nameprefixes --rows --unquoted --noheadings -ouuid,size,free,extent_size,extent_count,free_count,pv_count $env{LVM2_VG_NAME}"
  40. ENV{ID_FS_TYPE}=="LVM2_member", IMPORT{program}="/usr/sbin/lvm lvs -a --ignorelockingfailure --units k --nosuffix --nameprefixes --rows --unquoted --noheadings -olv_name,lv_uuid,lv_size,lv_attr $env{LVM2_VG_NAME}"
  41. LABEL="yali_end"