This discussion is archived
1 Reply Latest reply: Feb 15, 2013 1:12 AM by MohanPoojari RSS

Error while configuring iscsi client node using udev for RAC on linux

764057 Newbie
Currently Being Moderated
Hi All,

I am setting up iSCSI on Oracle Enterprise Linux referring the document "+Build Your Own Oracle RAC Cluster on Oracle Enterprise Linux and iSCSI+" posted on OTN by Jeffrey Hunter.

After configuring the iscsi service on iscsi client node, the symbolic link iscsi under the /dev folder is not created when the iscsi and udev service is started.

Created the following UNIX shell script /etc/udev/scripts/iscsidev.sh on iscsi client node:
..............................................
#!/bin/sh

# FILE: /etc/udev/scripts/iscsidev.sh

BUS=${1}
HOST=${BUS%%:*}

[ -e /sys/class/iscsi_host ] || exit 1

file="/sys/class/iscsi_host/host${HOST}/device/session*/iscsi_session*/targetname"

target_name=$(cat ${file})

# This is not an open-scsi drive
if [ -z "${target_name}" ]; then
exit 1
fi

# Check if QNAP drive
check_qnap_target_name=${target_name%%:*}
if [ $check_qnap_target_name = "iqn.2004-04.com.qnap" ]; then
target_name=`echo "${target_name%.*}"`
fi

echo "${target_name##*.}"
..............................................

Following message is seen in the /var/log/messages:
+May 2 17:10:44 rashida1 udevd-event[15897]: run_program: exec of program '/etc/udev/scripts/iscsidev.sh' failed+

Please find below the output of the +iscsidev.sh+ script when executed manually:
=========================================
[root@rashida1 scripts]# sh iscsidev.sh
cat: /sys/class/iscsi_host/host/device/session*/iscsi_session*/targetname: No such file or directory
=========================================

Contents of directory : /sys/class/iscsi_host/host*
================================================================
[root@rashida1 scripts]# ls /sys/class/iscsi_host/host*
/sys/class/iscsi_host/host1:
device hwaddress initiatorname ipaddress netdev subsystem uevent

/sys/class/iscsi_host/host2:
device hwaddress initiatorname ipaddress netdev subsystem uevent
=================================================================

If I supply an argument to the script, it returns proper result as shown below:
=============================
[root@rashida1 scripts]# sh iscsidev.sh 1
crs1
[root@rashida1 scripts]# sh iscsidev.sh 2
data1
=============================
But this input/argument value is supposed to be passed internally to the udev daemon. And its value will keep on varying.

Please advice how I should proceed.

Regards.
  • 1. Re: Error while configuring iscsi client node using udev for RAC on linux
    MohanPoojari Newbie
    Currently Being Moderated
    I modified the iscsidev.sh on OEL6 as below and it worked for me:

    #!/bin/bash
    {
    BUS=${1}
    HOST=${BUS%%:*}
    LID=`echo ${BUS}|awk -F":" '{print $NF}'`

    [ -e /sys/class/iscsi_host ] || exit 1

    if [ -f /sys/class/iscsi_host/host${HOST}/device/session*/iscsi_session*/targetname ]
    then
    file="/sys/class/iscsi_host/host${HOST}/device/session*/iscsi_session*/targetname"
    else
    file="/sys/class/iscsi_host/host${HOST}/device/session*/iscsi_session/session*/targetname"
    fi

    target_name=$(cat ${file})

    # This is not an open-scsi drive
    if [ -z "${target_name}" ]; then
    exit 1
    fi

    # Check if QNAP drive
    check_qnap_target_name=${target_name%%:*}
    if [ $check_qnap_target_name = "iqn.2004-04.com.qnap" ]; then
    target_name=`echo "${target_name%.*}"`
    fi

    echo "${target_name##*.}"

    LUN=`echo $target_name|awk -F":" '{print $NF}'`

    echo `date` $0 $* ${LUN}_${LID}
    } >>/tmp/udev_getlun.log
    echo ${LUN}_${LID}

    Now restart iscsi service

    service iscsi stop
    service iscsi start

    Wait for 2-3minutes,

    check /var/log/messages file and do a listing using ls -ltr /dev/iscsi/*

    Reboot the server and do the checks again

    At this stage, you will see the list of persistent devices.

    Please confirm if it resolves your issue.


    Thanks

    Mohan

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points