summaryrefslogtreecommitdiffstats
path: root/udev/69-dm-lvm-metad.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/69-dm-lvm-metad.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/69-dm-lvm-metad.rules.in')
-rw-r--r--udev/69-dm-lvm-metad.rules.in26
1 files changed, 26 insertions, 0 deletions
diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in
new file mode 100644
index 00000000..26309deb
--- /dev/null
+++ b/udev/69-dm-lvm-metad.rules.in
@@ -0,0 +1,26 @@
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+#
+# This file is part of LVM2.
+
+# Udev rules for LVM.
+#
+# Scan all block devices having a PV label for LVM metadata.
+# Store this information in LVMetaD (the LVM metadata daemon) and maintain LVM
+# metadata state for improved performance by avoiding further scans while
+# running subsequent LVM commands or while using lvm2app library.
+# Also, notify LVMetaD about any relevant block device removal.
+#
+# This rule is essential for having the information in LVMetaD up-to-date.
+# It also requires blkid to be called on block devices before so only devices
+# used as LVM PVs are processed (ID_FS_TYPE="LVM2_member" or "LVM1_member").
+
+SUBSYSTEM!="block", GOTO="lvm_end"
+(LVM_EXEC_RULE)
+
+# Device-mapper devices are processed only on change event or on supported synthesized event.
+KERNEL=="dm-[0-9]*", ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="lvm_end"
+
+# Only process devices already marked as a PV - this requires blkid to be called before.
+ENV{ID_FS_TYPE}=="LVM2_member|LVM1_member", RUN+="(LVM_EXEC)/lvm pvscan --cache --major $major --minor $minor"
+
+LABEL="lvm_end"