SUSE Support

Here When You Need Us

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

SUSE Linux Enterprise Server 12 Service Pack 1 (SLES 12 SP1)

Situation

The "/dev/disk/by-path" links are not unique for Fibre Channel NPIV devices.

Resolution

It is needed to create two additional udev files each with the content and location / naming as below:

1. "/usr/lib/udev/rules.d/59-fc-wwpn-id.rules"

#
# 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"

2. "/usr/lib/udev/fc_wwpn_id"

#!/bin/bash
#
# 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


3. Make sure to set the script file to be executable by running "chmod +x /usr/lib/udev/fc_wwpn_id".

Cause

Creation of symlinks for Fibre Channel NPIV devices are not handled correctly.

Additional Information

For SLES12 SP2 and later, the issue is resolved with "sg3_utils-1.43-16.5.1.x86_64" and later. However since SLES12 SP1 is in LTSS (Long Term Service Pack Support) updates for SP1 can only be accepted if the problem is a regression that was caused by a maintenance update, which is not the case here.

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

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.