dm-uevent.rst 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. ====================
  2. device-mapper uevent
  3. ====================
  4. The device-mapper uevent code adds the capability to device-mapper to create
  5. and send kobject uevents (uevents). Previously device-mapper events were only
  6. available through the ioctl interface. The advantage of the uevents interface
  7. is the event contains environment attributes providing increased context for
  8. the event avoiding the need to query the state of the device-mapper device after
  9. the event is received.
  10. There are two functions currently for device-mapper events. The first function
  11. listed creates the event and the second function sends the event(s)::
  12. void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti,
  13. const char *path, unsigned nr_valid_paths)
  14. void dm_send_uevents(struct list_head *events, struct kobject *kobj)
  15. The variables added to the uevent environment are:
  16. Variable Name: DM_TARGET
  17. ------------------------
  18. :Uevent Action(s): KOBJ_CHANGE
  19. :Type: string
  20. :Description:
  21. :Value: Name of device-mapper target that generated the event.
  22. Variable Name: DM_ACTION
  23. ------------------------
  24. :Uevent Action(s): KOBJ_CHANGE
  25. :Type: string
  26. :Description:
  27. :Value: Device-mapper specific action that caused the uevent action.
  28. PATH_FAILED - A path has failed;
  29. PATH_REINSTATED - A path has been reinstated.
  30. Variable Name: DM_SEQNUM
  31. ------------------------
  32. :Uevent Action(s): KOBJ_CHANGE
  33. :Type: unsigned integer
  34. :Description: A sequence number for this specific device-mapper device.
  35. :Value: Valid unsigned integer range.
  36. Variable Name: DM_PATH
  37. ----------------------
  38. :Uevent Action(s): KOBJ_CHANGE
  39. :Type: string
  40. :Description: Major and minor number of the path device pertaining to this
  41. event.
  42. :Value: Path name in the form of "Major:Minor"
  43. Variable Name: DM_NR_VALID_PATHS
  44. --------------------------------
  45. :Uevent Action(s): KOBJ_CHANGE
  46. :Type: unsigned integer
  47. :Description:
  48. :Value: Valid unsigned integer range.
  49. Variable Name: DM_NAME
  50. ----------------------
  51. :Uevent Action(s): KOBJ_CHANGE
  52. :Type: string
  53. :Description: Name of the device-mapper device.
  54. :Value: Name
  55. Variable Name: DM_UUID
  56. ----------------------
  57. :Uevent Action(s): KOBJ_CHANGE
  58. :Type: string
  59. :Description: UUID of the device-mapper device.
  60. :Value: UUID. (Empty string if there isn't one.)
  61. An example of the uevents generated as captured by udevmonitor is shown
  62. below
  63. 1.) Path failure::
  64. UEVENT[1192521009.711215] change@/block/dm-3
  65. ACTION=change
  66. DEVPATH=/block/dm-3
  67. SUBSYSTEM=block
  68. DM_TARGET=multipath
  69. DM_ACTION=PATH_FAILED
  70. DM_SEQNUM=1
  71. DM_PATH=8:32
  72. DM_NR_VALID_PATHS=0
  73. DM_NAME=mpath2
  74. DM_UUID=mpath-35333333000002328
  75. MINOR=3
  76. MAJOR=253
  77. SEQNUM=1130
  78. 2.) Path reinstate::
  79. UEVENT[1192521132.989927] change@/block/dm-3
  80. ACTION=change
  81. DEVPATH=/block/dm-3
  82. SUBSYSTEM=block
  83. DM_TARGET=multipath
  84. DM_ACTION=PATH_REINSTATED
  85. DM_SEQNUM=2
  86. DM_PATH=8:32
  87. DM_NR_VALID_PATHS=1
  88. DM_NAME=mpath2
  89. DM_UUID=mpath-35333333000002328
  90. MINOR=3
  91. MAJOR=253
  92. SEQNUM=1131