Udev integration: udev rules 2/3
PATCH 1/1 Udev integration: udev rules 2/3
This one is for LVM -- to create symlinks under /dev directory. That's all :)
# udev rules for LVM # This will create LVM symlinks in /dev directory.
SUBSYSTEM!="block", GOTO="lvm_end"
KERNEL!="dm-[0-9]*", GOTO="lvm_end"
ACTION!="change|remove", GOTO="lvm_end"
ACTION=="change", IMPORT{PROGRAM}="/sbin/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o name,uuid,subsystem,vg_name,lv_name,lv_layer" ENV{DM_UUID}!="LVM-?*", GOTO="lvm_end"
# Do not create symlinks for hidden subdevices. ENV{DM_LV_NAME}=="?*_mlog", GOTO="notify" ENV{DM_LV_NAME}=="?*_mimage_[0-9]*", GOTO="notify"
# Create symlinks for top level devices only.
ENV{DM_VG_NAME}=="?*", ENV{DM_LV_NAME}=="?*", ENV{DM_LV_LAYER}!="?*", SYMLINK+="$env{DM_VG_NAME}/$env{DM_LV_NAME}"
LABEL="notify", ENV{COOKIE}=="[0-9]*", RUN+="/sbin/dmsetup notify $env{COOKIE}", OPTIONS+="last_rule"
LABEL="lvm_end"
PATCH 1/1 Udev integration: udev rules 2/3
Quoted 2 lines · Peter Rajnoha
# udev rules for LVM # This will create LVM symlinks in /dev directory.
Again, describe in more detail what the script is doing. Needs (C) notices too.
Quoted 5 lines
SUBSYSTEM!="block", GOTO="lvm_end"
KERNEL!="dm-[0-9]*", GOTO="lvm_end"
ACTION!="change|remove", GOTO="lvm_end"ACTION=="change", IMPORT{PROGRAM}="/sbin/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o name,uuid,subsystem,vg_name,lv_name,lv_layer"
If we already have the name (e.g. from sysfs), I think we talked about adding a 'split up this name' command to dmsetup which does not perform any ioctls.
Quoted 1 line
ENV{DM_UUID}!="LVM-?*", GOTO="lvm_end"
Seems to be some repetition here. Does udev support including files inline within other files?
Quoted 3 lines
# Do not create symlinks for hidden subdevices. ENV{DM_LV_NAME}=="?*_mlog", GOTO="notify" ENV{DM_LV_NAME}=="?*_mimage_[0-9]*", GOTO="notify"
I think the rule was based on lv_layer: if it exists, don't create symlink, otherwise do.
- Don't think mirrors need to be singled out, do they?
Alasdair
Signature · 1 line
agk at redhat.com
PATCH 1/1 Udev integration: udev rules 2/3
Quoted 6 lines · Alasdair G Kergon
Quoted 2 lines · Peter Rajnoha
# udev rules for LVM # This will create LVM symlinks in /dev directory.Again, describe in more detail what the script is doing. Needs (C) notices too.
ok, I'll add that...
Quoted 6 lines
Quoted 5 lines
SUBSYSTEM!="block", GOTO="lvm_end"
KERNEL!="dm-[0-9]*", GOTO="lvm_end"
ACTION!="change|remove", GOTO="lvm_end"ACTION=="change", IMPORT{PROGRAM}="/sbin/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o name,uuid,subsystem,vg_name,lv_name,lv_layer"
Quoted 7 lines
If we already have the name (e.g. from sysfs), I think we talked about adding a 'split up this name' command to dmsetup which does not perform any ioctls.
Quoted 1 line
ENV{DM_UUID}!="LVM-?*", GOTO="lvm_end"
Seems to be some repetition here. Does udev support including files inline within other files?
Unfortunately not (or I haven't found it documented). The only thing we can do about including files is IMPORT{FILE} rule, but this is restricted to KEY=VALUE pairs only...
Peter
PATCH 1/1 Udev integration: udev rules 2/3
In reply to Alasdair G KergonQuoted 5 lines · Alasdair G Kergon
Quoted 1 line · Peter Rajnoha
ENV{DM_UUID}!="LVM-?*", GOTO="lvm_end"
Seems to be some repetition here. Does udev support including files inline within other files?
This just reminds me one thing -- we don't have to assign DM_UUID and DM_NAME vars in the rules following the basic DM udev rules. Once it's assigned, it's set in the other rules as well, so we can save a little with this, no need to read it again.
Peter