[dm-devel] [PATCH 03/11] kpartx_id: Generate persistent symlinks for 'wwn'
Hannes Reinecke
hare at suse.de
Thu Jan 17 14:59:25 UTC 2013
Newer udev versions generate /dev/disk/by-id/wwn-* symlinks.
We should be adjusting those for multipathing, too.
Signed-off-by: Hannes Reinecke <hare at suse.de>
---
kpartx/kpartx.rules | 4 ++++
kpartx/kpartx_id | 2 ++
2 files changed, 6 insertions(+)
diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index 8640094..b96ec89 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -20,12 +20,16 @@ ENV{DM_UUID}=="mpath-*", \
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
ENV{DM_MPATH}=="?*", ENV{DM_PART}!="?*", \
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_MPATH}"
+ENV{DM_WWN}=="?*", ENV{DM_PART}!="?*", \
+ SYMLINK+="disk/by-id/wwn-$env{DM_WWN}"
# Create persistent links for partitions
ENV{DM_PART}=="?*", \
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}-part$env{DM_PART}"
ENV{DM_MPATH}=="?*", ENV{DM_PART}=="?*", \
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_MPATH}-part$env{DM_PART}"
+ENV{DM_WWN}=="?*", ENV{DM_PART}=="?*", \
+ SYMLINK+="disk/by-id/wwn-$env{DM_WWN}-part$env{DM_PART}"
# Create dm tables for partitions
ENV{DM_STATE}!="SUSPENDED", ENV{DM_UUID}=="mpath-*", \
diff --git a/kpartx/kpartx_id b/kpartx/kpartx_id
index afb589c..47fab1a 100644
--- a/kpartx/kpartx_id
+++ b/kpartx/kpartx_id
@@ -69,6 +69,7 @@ elif [ "$dmtbl" = "mpath" ] ; then
if [ -n "$DM_NAME" -a "$DM_NAME" != "$dmuuid" ] ; then
echo "DM_MPATH=$dmuuid"
fi
+ dmname="$dmuuid"
# We need the dependencies of the table to figure out the type
dmdeps=$($DMSETUP deps -u $UUID)
elif [ "$dmtbl" = "dmraid" ] ; then
@@ -92,6 +93,7 @@ if [ -n "$dmdeps" ] ; then
;;
*)
echo "DM_TYPE=scsi"
+ echo "DM_WWN=0x${dmname#?}"
;;
esac
else
--
1.7.10.4
More information about the dm-devel
mailing list