Update udev rules file
authorBryn M. Reeves <bmr@redhat.com>
Wed, 31 Oct 2012 18:59:02 +0000 (18:59 +0000)
committerBryn M. Reeves <bmr@redhat.com>
Wed, 31 Oct 2012 18:59:02 +0000 (18:59 +0000)
Correct several bugs in the udev rules and fix support for whole-
disk vs. partitioned devices. Udev link priorities are used to
prefer multipath over sd and partitions over whole-disks. This
may not work for all situations but covers those documented in
the existing guides.

99-blkdevalias.rules

index 35136c9..6cbaa5e 100644 (file)
@@ -1,5 +1,22 @@
-#KERNEL=="sd*", PROGRAM="/sbin/scsi_id -g -u -d$tempnode", RESULT=="0QEMU_QEMU_HARDDISK_drive-scsi0-0-0", NAME="oracleasm/disks/DSK1", OWNER="oracle", GROUP="oracle"
-#KERNEL=="sd*", PROGRAM="/sbin/scsi_id -g -u -d$tempnode", RESULT=="0QEMU_QEMU_HARDDISK_drive-scsi0-0-1", NAME="oracleasm/disks/DSK2", OWNER="oracle", GROUP="oracle"
-#KERNEL=="sd*", PROGRAM="/sbin/scsi_id -g -u -d$tempnode", RESULT=="0QEMU_QEMU_HARDDISK_drive-scsi0-0-2", NAME="oracleasm/disks/DSK3", OWNER="oracle", GROUP="oracle"
-KERNEL=="sd*[0-9]", PROGRAM="/sbin/scsi_id -g -u -d/dev/$parent" IMPORT="/sbin/blkdevalias map %c" SYMLINK+="$env{WM_NAME}" OWNER="$env{WM_OWNER}" GROUP="$env{WM_GROUP}"
-KERNEL=="sd*", PROGRAM="/sbin/scsi_id -g -u -dtempnode" IMPORT="/sbin/blkdevalias map %c" SYMLINK+="$env{WM_NAME}" OWNER="$env{WM_OWNER}" GROUP="$env{WM_GROUP}"
+KERNEL=="sd*[^0-9]" ENV{DEVTYPE}=="disk" \
+    PROGRAM="/sbin/scsi_id -g -u -d$tempnode" \
+    IMPORT="/sbin/wwidmap map %c" \
+    SYMLINK+="$env{WM_NAME}" OWNER="$env{WM_USER}" GROUP="$env{WM_GROUP}"
+
+KERNEL=="sd*[1-9]*" ENV{DEVTYPE}=="partition" \
+    PROGRAM="/sbin/scsi_id -g -u -d/dev/$parent" \
+    IMPORT="/sbin/wwidmap map %c" \
+    SYMLINK+="$env{WM_NAME}" OWNER="$env{WM_USER}" GROUP="$env{WM_GROUP}" \
+    OPTIONS+={link_priority=5}
+
+KERNEL=="dm*" ENV{DM_UUID}=="mpath*" \
+    PROGRAM="/sbin/scsi_id -g -u -d$tempnode" \
+    IMPORT="/sbin/wwidmap map %c" \
+    SYMLINK+="$env{WM_NAME}" OWNER="$env{WM_USER}" GROUP="$env{WM_GROUP}" \
+    OPTIONS+="link_priority=10"
+
+KERNEL=="dm*" ENV{DM_UUID}=="part*mpath*" \
+    PROGRAM="/sbin/scsi_id -g -u -d/dev/$parent" \
+    IMPORT="/sbin/wwidmap map %c" \
+    SYMLINK+="$env{WM_NAME}" OWNER="$env{WM_USER}" GROUP="$env{WM_GROUP}" \
+    OPTIONS+="link_priority=15"