1 Reply Latest reply: May 13, 2013 11:08 PM by user10955371 RSS

    Configuring udev rules for Oracle 10g R2 Rac on OEL 5.5 U4 with Qnap

    783542
      I'm trying to setup a 10g RAC Cluster following the guide by Jeff Hunter on http://www.idevelopment.info/

      I have to admit, im no Linux admin, and have searched round the net for help with the following Issue.

      I'm trying to set my iSCSI targets to have persistent mappings using udev rules

      This is what I have done so far

      [root@racnode1 Server]# iscsiadm -m discovery -t sendtargets -p nas-priv | grep 192.168.2.196
      192.168.2.196:3260,1 iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote1.c59a2d
      192.168.2.196:3260,1 iqn.2004-04.com.qnap:ts-459:iscsi.racdbfra2.c59a2d
      192.168.2.196:3260,1 iqn.2004-04.com.qnap:ts-459:iscsi.racdbdata2.c59a2d
      192.168.2.196:3260,1 iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote2.c59a2d
      192.168.2.196:3260,1 iqn.2004-04.com.qnap:ts-459:iscsi.racdbcrs2.c59a2d
      192.168.2.196:3260,1 iqn.2004-04.com.qnap:ts-459:iscsi.racdbcrs1.c59a2d
      192.168.2.196:3260,1 iqn.2004-04.com.qnap:ts-459:iscsi.racdbdata1.c59a2d
      192.168.2.196:3260,1 iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote3.c59a2d
      192.168.2.196:3260,1 iqn.2004-04.com.qnap:ts-459:iscsi.racdbfra1.c59a2d

      -- Manually Log into iSCSI Targets
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote1.c59a2d -p 192.168.2.196 -l
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbfra2.c59a2d -p 192.168.2.196 -l
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbdata2.c59a2d -p 192.168.2.196 -l
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote2.c59a2d -p 192.168.2.196 -l
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbcrs2.c59a2d -p 192.168.2.196 -l
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbcrs1.c59a2d -p 192.168.2.196 -l
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbdata1.c59a2d -p 192.168.2.196 -l
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote3.c59a2d -p 192.168.2.196 -l
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbfra1.c59a2d -p 192.168.2.196 -l

      -- Make iSCSI Targets Automatically Login
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote1.c59a2d -p 192.168.2.196 --op update -n node.startup -v automatic
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbfra2.c59a2d -p 192.168.2.196 --op update -n node.startup -v automatic
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbdata2.c59a2d -p 192.168.2.196 --op update -n node.startup -v automatic
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote2.c59a2d -p 192.168.2.196 --op update -n node.startup -v automatic
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbcrs2.c59a2d -p 192.168.2.196 --op update -n node.startup -v automatic
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbcrs1.c59a2d -p 192.168.2.196 --op update -n node.startup -v automatic
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbdata1.c59a2d -p 192.168.2.196 --op update -n node.startup -v automatic
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote3.c59a2d -p 192.168.2.196 --op update -n node.startup -v automatic
      iscsiadm -m node -T iqn.2004-04.com.qnap:ts-459:iscsi.racdbfra1.c59a2d -p 192.168.2.196 --op update -n node.startup -v automatic


      -- Create Persistent Local SCSI Device Names

      - Identify Mappings

      [root@racnode1 ~]# (cd /dev/disk/by-path; ls -l qnap | awk '{FS=" "; print $9 " " $10 " " $11}')
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbcrs1.c59a2d-lun-0 -> ../../sdg
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbcrs2.c59a2d-lun-0 -> ../../sdf
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbdata1.c59a2d-lun-0 -> ../../sdi
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbdata2.c59a2d-lun-0 -> ../../sdd
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbfra1.c59a2d-lun-0 -> ../../sdj
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbfra2.c59a2d-lun-0 -> ../../sdc
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote1.c59a2d-lun-0 -> ../../sdb
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote2.c59a2d-lun-0 -> ../../sde
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote3.c59a2d-lun-0 -> ../../sdh

      - Create Rules File

      cat >> /etc/udev/rules.d/55-openiscsi.rules <<EOF
      # /etc/udev/rules.d/55-openiscsi.rules
      KERNEL=="sd*", BUS=="scsi", PROGRAM="/etc/udev/scripts/iscsidev.sh %b",SYMLINK+="iscsi/%c/part%n"
      EOF

      - Create Shell Script
      mkdir -p /etc/udev/scripts


      vi /etc/udev/scripts/iscsidev.sh


      #!/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##*.}"



      chmod 755 /etc/udev/scripts/iscsidev.sh

      service iscsi stop
      service iscsi start

      [root@racnode1 ~]# ls /dev/iscsi/*
      ls: /dev/iscsi/*: No such file or directory


      1.) For some reason I cannot get the mappings to work correctly, I have rebooted the server and tried a number of different changes in the rules script. But for the life of me I cannot get it work.

      I noticed when I rebooted the server that it failed to execute the iscsidev. When I manually run the shell script with a parameter it produces output

      Can anyone help me to get this up and running?

      2.) My QNAP Nas doesnt seem to publish iSCSI targets to only one NIC. I think this is down to the firmware/feature not being available. When I discover targets I get the following


      [root@racnode1 ~]# (cd /dev/disk/by-path; ls -l *qnap* | awk '{FS=" "; print $9 " " $10 " " $11}')
      ip-192.168.1.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbcrs1.c59a2d-lun-0 -> ../../sdh
      ip-192.168.1.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbcrs2.c59a2d-lun-0 -> ../../sdm
      ip-192.168.1.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbdata1.c59a2d-lun-0 -> ../../sdn
      ip-192.168.1.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbdata2.c59a2d-lun-0 -> ../../sde
      ip-192.168.1.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbfra1.c59a2d-lun-0 -> ../../sdr
      ip-192.168.1.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbfra2.c59a2d-lun-0 -> ../../sdd
      ip-192.168.1.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote1.c59a2d-lun-0 -> ../../sdb
      ip-192.168.1.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote2.c59a2d-lun-0 -> ../../sdk
      ip-192.168.1.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote3.c59a2d-lun-0 -> ../../sdp
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbcrs1.c59a2d-lun-0 -> ../../sdi
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbcrs2.c59a2d-lun-0 -> ../../sdg
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbdata1.c59a2d-lun-0 -> ../../sdo
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbdata2.c59a2d-lun-0 -> ../../sdj
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbfra1.c59a2d-lun-0 -> ../../sds
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbfra2.c59a2d-lun-0 -> ../../sdf
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote1.c59a2d-lun-0 -> ../../sdc
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote2.c59a2d-lun-0 -> ../../sdl
      ip-192.168.2.196:3260-iscsi-iqn.2004-04.com.qnap:ts-459:iscsi.racdbvote3.c59a2d-lun-0 -> ../../sdq


      It shows the same targets on both NIC's, I only need them on the private ip 192.168.2.196

      Edited by: user1728822 on 07-May-2011 15:53

      Edited by: user1728822 on 07-May-2011 16:08