Work around to get WWID for mpath partitions
authorBryn M. Reeves <bmr@redhat.com>
Thu, 1 Nov 2012 01:29:23 +0000 (01:29 +0000)
committerBryn M. Reeves <bmr@redhat.com>
Thu, 1 Nov 2012 01:29:23 +0000 (01:29 +0000)
Partitions don't accept SG_IO ioctls anymore so we need
to run scsi_id on the parent mpath device. There's no
way to get this from the current standard dm udev
environment so add a hack to generate it from DM_NAME.

99-blkdevalias.rules
mpath-parent [new file with mode: 0755]

index e693823..6b2f59d 100644 (file)
@@ -15,8 +15,11 @@ KERNEL=="dm*" ENV{DM_UUID}=="mpath*" \
     SYMLINK+="$env{BA_NAME}" OWNER="$env{BA_USER}" GROUP="$env{BA_GROUP}" \
     OPTIONS+="link_priority=10"
 
-KERNEL=="dm*" ENV{DM_UUID}=="part*mpath*" \
-    PROGRAM="/sbin/scsi_id -g -u -d/dev/$parent" \
+KERNEL=="dm*" ENV{DM_UUID}=="part*" \
+    IMPORT="/sbin/mpath-parent $env{DM_NAME}"
+
+KERNEL=="dm*" ENV{DM_UUID}=="part*" \
+    PROGRAM="/sbin/scsi_id -g -u -d/dev/mapper/$env{DM_PARENT}" \
     IMPORT="/sbin/blkdevalias map %c" \
     SYMLINK+="$env{BA_NAME}" OWNER="$env{BA_USER}" GROUP="$env{BA_GROUP}" \
     OPTIONS+="link_priority=15"
diff --git a/mpath-parent b/mpath-parent
new file mode 100755 (executable)
index 0000000..c55673a
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+echo "DM_PARENT=$(echo $1|sed 's/p[0-9]*$//')"