kpartx_id: Generate persistent symlinks for 'wwn'
authorHannes Reinecke <hare@suse.de>
Thu, 17 Jan 2013 14:59:25 +0000 (15:59 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Fri, 18 Jan 2013 19:02:27 +0000 (20:02 +0100)
Newer udev versions generate /dev/disk/by-id/wwn-* symlinks.
We should be adjusting those for multipathing, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
kpartx/kpartx.rules
kpartx/kpartx_id

index 8640094..b96ec89 100644 (file)
@@ -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-*", \
index afb589c..47fab1a 100644 (file)
@@ -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