summaryrefslogtreecommitdiff
path: root/udev
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2014-02-18 11:27:21 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2014-02-18 11:37:20 +0100
commit417e52c13a8156b11c25c411d44bda8b32bf87e4 (patch)
treecfd78e5e8febba83ad8381e88c5e9ddbd6ad6f8e /udev
parent0e0f91b6ddcdd338bcd528b3f44eb3f019704fb3 (diff)
downloadlvm2-417e52c13a8156b11c25c411d44bda8b32bf87e4.tar.gz
udev: create /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for a PV
We already have /dev/disk/by-id/dm-uuid-... (which encompasses the VG UUID and LV UUID in case of LVs since the mapping's UUID is VG+LV UUID together) and /dev/disk/by-id/dm-name-... (which encompasses the VG and LV name in case of LVs). This patch addds /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> that completes this scheme and makes navigation a bit easier using PV UUIDs since one can navigate using PV UUIDs only and there's no need to do extra PV UUID <--> kernel name matching (the PV UUID is stable across reboots). This may come in handy in various scripts. Since we already have the PV UUID stored in udev database (as a result of blkid call - returned in ID_FS_UUID blkid's variable), this operation is very cheap indeed, just creating the extra one symlink.
Diffstat (limited to 'udev')
-rw-r--r--udev/69-dm-lvm-metad.rules.in3
1 files changed, 3 insertions, 0 deletions
diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in
index e8304b5e0..bd75fc8ef 100644
--- a/udev/69-dm-lvm-metad.rules.in
+++ b/udev/69-dm-lvm-metad.rules.in
@@ -34,6 +34,9 @@ ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end"
# Inform lvmetad about any PV that is gone.
ACTION=="remove", GOTO="lvm_scan"
+# Create /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for each PV
+ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-id/lvm-pv-uuid-$env{ID_FS_UUID_ENC}"
+
# If the PV is a special device listed below, scan only if the device is
# properly activated. These devices are not usable after an ADD event,
# but they require an extra setup and they are ready after a CHANGE event.