summaryrefslogtreecommitdiffstats
path: root/udev/11-dm-lvm.rules.in
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2012-06-22 05:50:02 -0400
committerPeter Rajnoha <prajnoha@redhat.com>2012-06-27 12:11:56 +0200
commite6f8d86409e54300aeda05a82aad9b072d22ed4d (patch)
treed2cf9af1ae67694c79ce15acd024ec3d93531e3f /udev/11-dm-lvm.rules.in
parent9a96f930a762418f1014f6a9da9546cb1f501f04 (diff)
downloadlvm2-e6f8d86409e54300aeda05a82aad9b072d22ed4d.tar.gz
lvm2-e6f8d86409e54300aeda05a82aad9b072d22ed4d.tar.xz
lvm2-e6f8d86409e54300aeda05a82aad9b072d22ed4d.zip
udev: udev rules cleanup
Remove executable path detection in udev rules and use sbindir that is configured, but still provide the original functionality by means of 'configure --enable-udev-rule-exec-detection'. Normally, the exec path for the tools called in udev rules should not differ from the sbindir used, however, there are cases this is necessary. For example different environments could be assembled in a way that these path differ for some reason (distribution installer, initrd ...). This functionality is kept for compatibility only. Any environment moving the binaries around and using different paths should be fixed eventually!
Diffstat (limited to 'udev/11-dm-lvm.rules.in')
-rw-r--r--udev/11-dm-lvm.rules.in37
1 files changed, 37 insertions, 0 deletions
diff --git a/udev/11-dm-lvm.rules.in b/udev/11-dm-lvm.rules.in
new file mode 100644
index 00000000..58ef2106
--- /dev/null
+++ b/udev/11-dm-lvm.rules.in
@@ -0,0 +1,37 @@
+# Copyright (C) 2009 Red Hat, Inc. All rights reserved.
+#
+# This file is part of LVM2.
+
+# Udev rules for LVM.
+#
+# These rules create symlinks for LVM logical volumes in
+# /dev/VG directory (VG is an actual VG name). Some udev
+# environment variables are set (they can be used in later
+# rules as well):
+# DM_LV_NAME - logical volume name
+# DM_VG_NAME - volume group name
+# DM_LV_LAYER - logical volume layer (blank if not set)
+
+# "add" event is processed on coldplug only!
+ACTION!="add|change", GOTO="lvm_end"
+ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="lvm_end"
+ENV{DM_UUID}!="LVM-?*", GOTO="lvm_end"
+
+# Use DM name and split it up into its VG/LV/layer constituents.
+IMPORT{program}="(DM_EXEC)/dmsetup splitname --nameprefixes --noheadings --rows $env{DM_NAME}"
+
+ENV{DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG}=="1", GOTO="lvm_end"
+
+# Do not create symlinks for inappropriate subdevices.
+ENV{DM_LV_NAME}=="pvmove?*|?*_vorigin", GOTO="lvm_disable"
+ENV{DM_LV_LAYER}=="?*", GOTO="lvm_disable"
+
+# Create symlinks for top-level devices only.
+ENV{DM_VG_NAME}=="?*", ENV{DM_LV_NAME}=="?*", SYMLINK+="$env{DM_VG_NAME}/$env{DM_LV_NAME}", GOTO="lvm_end"
+
+LABEL="lvm_disable"
+ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1"
+ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
+OPTIONS:="nowatch"
+
+LABEL="lvm_end"