Fibre Channel NPIV - device names in /dev/disk/by-path are not persistent / unique
This document (7022659) is provided subject to the disclaimer at the end of this document.
Environment
Situation
Resolution
1. "/usr/lib/udev/rules.d/59-fc-wwpn-id.rules"
#2. "/usr/lib/udev/fc_wwpn_id"
# FC WWPN-based by-path links
#
ACTION!="add|change", GOTO="fc_wwpn_end"
KERNEL!="sd*", GOTO="fc_wwpn_end"
ENV{DEVTYPE}=="disk", IMPORT{program}="fc_wwpn_id %p"
ENV{DEVTYPE}=="partition", IMPORT{parent}="FC_*"
ENV{FC_TARGET_WWPN}!="$*"; GOTO="fc_wwpn_end"
ENV{FC_INITIATOR_WWPN}!="$*"; GOTO="fc_wwpn_end"
ENV{FC_TARGET_LUN}!="$*"; GOTO="fc_wwpn_end"
ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-path/fc-$env{FC_INITIATOR_WWPN}-$env{FC_TARGET_WWPN}-lun-$env{FC_TARGET_LUN}"
ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-path/fc-$env{FC_INITIATOR_WWPN}-$env{FC_TARGET_WWPN}-lun-$env{FC_TARGET_LUN}-part%n"
LABEL="fc_wwpn_end"
#!/bin/bash3. Make sure to set the script file to be executable by running "chmod +x /usr/lib/udev/fc_wwpn_id".
#
# fc_wwpn_id
#
# Generates device node names links based on FC WWPN
# Copyright (c) 2016 Hannes Reinecke, SUSE Linux GmbH
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation version 2 of the License.
#
DEVPATH=$1
SCSIPATH=$(cd -P "/sys$DEVPATH/device" || exit; echo "$PWD")
d=$SCSIPATH
[ -d "$d/scsi_disk" ] || exit 0
target_lun=${d##*:}
while [ -n "$d" ] ; do
d=${d%/*}
e=${d##*/}
case "$e" in
rport*)
rport=$e
rport_dir="/sys/class/fc_remote_ports/$rport"
if [ -d "$rport_dir" ] ; then
rport_wwpn=$(cat "$rport_dir/port_name")
fi
;;
host*)
host=$e
host_dir="/sys/class/fc_host/$host"
if [ -d "$host_dir" ] ; then
host_wwpn=$(cat "$host_dir/port_name")
break;
fi
esac
done
echo "FC_TARGET_LUN=$target_lun"
if [ -n "$rport_wwpn" ] ; then
echo "FC_TARGET_WWPN=$rport_wwpn"
fi
if [ -n "$host_wwpn" ] ; then
echo "FC_INITIATOR_WWPN=$host_wwpn"
fi
Cause
Additional Information
Due to this the resolution to resolve the issue for SLES12 SP1 systems are documented with this TID.
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:7022659
- Creation Date: 13-Feb-2018
- Modified Date:03-Mar-2020
-
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com