components/sg3_utils/patches/rescan-scsi-bus-fixes.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Wed, 29 Aug 2012 11:05:56 -0700
changeset 957 255465c5756f
parent 956 8dfd8bd38819
permissions -rw-r--r--
Close of build 04.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
956
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     1
From 38842b5eafcd85bc91d96e2b2d0b99ea8864d907 Mon Sep 17 00:00:00 2001
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     2
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     3
Date: Thu, 14 Jan 2010 12:50:05 +0100
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     4
Subject: [PATCH 1/5] netapp - fixes in doreportlun
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     5
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     6
---
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     7
 rescan-scsi-bus.sh |   64 ++++++++++++++++++++++++++++++++++------------------
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     8
 1 files changed, 42 insertions(+), 22 deletions(-)
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     9
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    10
diff --git a/rescan-scsi-bus.sh b/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    11
index af1f843..8d52e39 100644
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    12
--- a/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    13
+++ b/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    14
@@ -371,38 +371,58 @@ dolunscan()
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    15
 # Perform report lun scan
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    16
 doreportlun()
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    17
 {
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    18
-  lun=0
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    19
+  lun=
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    20
   SCSISTR=
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    21
-  devnr="$host $channel $id $lun"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    22
-  echo "Scanning for device $devnr ..."
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    23
-  #printf "${yellow}OLD: $norm"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    24
-  testexist -q
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    25
-  if test -z "$SCSISTR"; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    26
-    # Device does not exist, try to add
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    27
-    #printf "\r${green}NEW: $norm"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    28
-    if test -e /sys/class/scsi_host/host${host}/scan; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    29
-      echo "$channel $id $lun" > /sys/class/scsi_host/host${host}/scan 2> /dev/null
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    30
-    else
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    31
-      echo "scsi add-single-device $devnr" > /proc/scsi/scsi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    32
-    fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    33
+  for dev in /sys/class/scsi_device/${host}:${channel}:${id}:*; do
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    34
+        if [ -d "$dev" ]; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    35
+                lun=${dev##*:}
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    36
+                break
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    37
+        else
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    38
+                continue
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    39
+        fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    40
+  done
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    41
+  #If not a single LUN is present then assign lun=0
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    42
+  if [ -z $lun ]; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    43
+    lun=0
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    44
+    devnr="$host $channel $id $lun"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    45
+    echo "Scanning for device $devnr ..."
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    46
+    printf "${yellow}OLD: $norm"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    47
     testexist -1
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    48
     if test -z "$SCSISTR"; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    49
-      # Device not present
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    50
-      printf "\r\x1b[A";
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    51
-      lunsearch=
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    52
-      return
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    53
+      # Device does not exist, try to add
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    54
+      printf "\r${green}NEW: $norm"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    55
+      if test -e /sys/class/scsi_host/host${host}/scan; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    56
+        echo "$channel $id $lun" > /sys/class/scsi_host/host${host}/scan 2> /dev/null
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    57
+      else
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    58
+        echo "scsi add-single-device $devnr" > /proc/scsi/scsi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    59
+      fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    60
+      testexist
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    61
+      if test -z "$SCSISTR"; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    62
+        # Device not present
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    63
+        printf "\r\x1b[A";
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    64
+        lunsearch=
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    65
+        return
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    66
+      fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    67
     fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    68
     #testonline
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    69
   fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    70
-  lunsearch=`getluns`
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    71
+  flag=0
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    72
+  lun_search="`getluns`"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    73
+  # Set flag=1 if all the LUNs are removed
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    74
+  if [ "${#lun_search}" = "1" ]; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    75
+    flag=1
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    76
+  fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    77
   lunremove=
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    78
   # Check existing luns
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    79
   for dev in /sys/class/scsi_device/${host}:${channel}:${id}:*; do
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    80
     [ -d "$dev" ] || continue
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    81
     lun=${dev##*:}
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    82
+    if [ "$flag" = "1" ]; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    83
+      lunremove="$lunremove $lun"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    84
+    fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    85
     newsearch=
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    86
-    oldsearch="$lunsearch"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    87
-    for tmplun in $lunsearch; do
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    88
+    oldsearch="$lun_search"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    89
+    for tmplun in $lun_search; do
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    90
       if test $tmplun -eq $lun ; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    91
 	dolunscan
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    92
       else
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    93
@@ -413,10 +433,10 @@ doreportlun()
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    94
 	# Stale lun
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    95
 	lunremove="$lunremove $lun"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    96
     fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    97
-    lunsearch="$newsearch"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    98
+    lun_search="$newsearch"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    99
   done
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   100
   # Add new ones and check stale ones
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   101
-  for lun in $lunsearch $lunremove; do
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   102
+  for lun in $lun_search $lunremove; do
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   103
     dolunscan
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   104
   done
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   105
 }
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   106
-- 
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   107
1.6.6.1
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   108
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   109
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   110
From 0e94e0c27d575f18a57938b9d98dfe02d8c11eb9 Mon Sep 17 00:00:00 2001
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   111
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   112
Date: Thu, 14 Jan 2010 12:50:59 +0100
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   113
Subject: [PATCH 2/5] netapp - LIP is not required to do a scan on FC
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   114
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   115
---
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   116
 rescan-scsi-bus.sh |    3 +--
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   117
 1 files changed, 1 insertions(+), 2 deletions(-)
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   118
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   119
diff --git a/rescan-scsi-bus.sh b/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   120
index 8d52e39..13e9283 100644
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   121
--- a/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   122
+++ b/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   123
@@ -587,11 +587,10 @@ declare -i rmvd=0
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   124
 for host in $hosts; do
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   125
   echo -n "Scanning host $host "
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   126
   if test -e /sys/class/fc_host/host$host ; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   127
-    # It's pointless to do a target scan on FC
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   128
     if test -n "$lipreset" ; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   129
       echo 1 > /sys/class/fc_host/host$host/issue_lip 2> /dev/null;
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   130
-      echo "- - -" > /sys/class/scsi_host/host$host/scan 2> /dev/null;
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   131
     fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   132
+    echo "- - -" > /sys/class/scsi_host/host$host/scan 2> /dev/null;
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   133
     channelsearch=""
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   134
     idsearch=""
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   135
   fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   136
-- 
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   137
1.6.6.1
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   138
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   139
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   140
From c3b67a28289bb010d141e172a184982c40e2fff2 Mon Sep 17 00:00:00 2001
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   141
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   142
Date: Thu, 14 Jan 2010 12:51:31 +0100
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   143
Subject: [PATCH 3/5] space before getluns call is required
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   144
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   145
---
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   146
 rescan-scsi-bus.sh |    2 +-
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   147
 1 files changed, 1 insertions(+), 1 deletions(-)
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   148
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   149
diff --git a/rescan-scsi-bus.sh b/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   150
index 13e9283..26a9853 100644
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   151
--- a/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   152
+++ b/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   153
@@ -407,7 +407,7 @@ doreportlun()
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   154
     #testonline
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   155
   fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   156
   flag=0
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   157
-  lun_search="`getluns`"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   158
+  lun_search=" `getluns`"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   159
   # Set flag=1 if all the LUNs are removed
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   160
   if [ "${#lun_search}" = "1" ]; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   161
     flag=1
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   162
-- 
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   163
1.6.6.1
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   164
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   165
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   166
From 5c10b085e2e83f371eddee16937157b0e7f63d5b Mon Sep 17 00:00:00 2001
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   167
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   168
Date: Thu, 14 Jan 2010 15:15:34 +0100
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   169
Subject: [PATCH 4/5] wait for device
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   170
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   171
When a device reports "unit attention" state after calling sg_turs, then wait until the device comes online or a timeout is reached.
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   172
---
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   173
 rescan-scsi-bus.sh |    8 ++++++--
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   174
 1 files changed, 6 insertions(+), 2 deletions(-)
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   175
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   176
diff --git a/rescan-scsi-bus.sh b/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   177
index 26a9853..23fba7d 100644
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   178
--- a/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   179
+++ b/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   180
@@ -195,8 +195,12 @@ testonline ()
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   181
   if test ! -x /usr/bin/sg_turs; then return 0; fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   182
   sgdevice
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   183
   if test -z "$SGDEV"; then return 0; fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   184
-  sg_turs /dev/$SGDEV >/dev/null 2>&1
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   185
-  RC=$?
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   186
+  for t in 1 2 3 4 5; do
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   187
+    sg_turs /dev/$SGDEV >/dev/null 2>&1
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   188
+    RC=$?
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   189
+    [ $RC -ne 6 ] && break
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   190
+    sleep $t
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   191
+  done
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   192
   # echo -e "\e[A\e[A\e[A${yellow}Test existence of $SGDEV = $RC ${norm} \n\n\n"
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   193
   if test $RC = 1; then return $RC; fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   194
   # OK, device online, compare INQUIRY string
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   195
-- 
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   196
1.6.6.1
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   197
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   198
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   199
From ab78298b801aa1afdbaa7091a9e4aecdf8d89d2c Mon Sep 17 00:00:00 2001
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   200
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   201
Date: Fri, 25 Jun 2010 11:23:28 +0200
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   202
Subject: [PATCH 5/5] accept user specified channel list when scanning FC host
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   203
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   204
Allow the user to specify channels to scan on FC host when trying to find
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   205
a first LUN. Option --forcerescan is used for that and when it's not given
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   206
it defaults to the old behaviour when it gets available channels from
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   207
/sys/class/scsi_device
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   208
---
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   209
 rescan-scsi-bus.sh |    2 +-
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   210
 1 files changed, 1 insertions(+), 1 deletions(-)
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   211
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   212
diff --git a/rescan-scsi-bus.sh b/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   213
index 23fba7d..a7fd1f3 100644
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   214
--- a/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   215
+++ b/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   216
@@ -595,7 +595,7 @@ for host in $hosts; do
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   217
       echo 1 > /sys/class/fc_host/host$host/issue_lip 2> /dev/null;
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   218
     fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   219
     echo "- - -" > /sys/class/scsi_host/host$host/scan 2> /dev/null;
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   220
-    channelsearch=""
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   221
+    [ -z $forcerescan ] && channelsearch=""
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   222
     idsearch=""
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   223
   fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   224
   [ -n "$channelsearch" ] && echo -n "channels $channelsearch "
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   225
-- 
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   226
1.6.6.1
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   227
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   228
From 857456759088a92cf9cd2dbfaa24b5bf9cb0829e Mon Sep 17 00:00:00 2001
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   229
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   230
Date: Wed, 22 Sep 2010 15:33:00 +0200
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   231
Subject: [PATCH] issue scan command also for iSCSI
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   232
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   233
iSCSI devices behave like FC ones, so they need to issue the scan command
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   234
first to work when there is no LUN==0 mapped.
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   235
---
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   236
 rescan-scsi-bus.sh |    5 +++--
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   237
 1 files changed, 3 insertions(+), 2 deletions(-)
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   238
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   239
diff --git a/rescan-scsi-bus.sh b/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   240
index a7fd1f3..1b9ea7d 100644
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   241
--- a/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   242
+++ b/rescan-scsi-bus.sh
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   243
@@ -590,10 +590,11 @@ declare -i found=0
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   244
 declare -i rmvd=0
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   245
 for host in $hosts; do
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   246
   echo -n "Scanning host $host "
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   247
-  if test -e /sys/class/fc_host/host$host ; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   248
-    if test -n "$lipreset" ; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   249
+  if test -e /sys/class/fc_host/host$host -o -e /sys/class/iscsi_host/host$host ; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   250
+    if test -e /sys/class/fc_host/host$host -a -n "$lipreset" ; then
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   251
       echo 1 > /sys/class/fc_host/host$host/issue_lip 2> /dev/null;
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   252
     fi
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   253
+    # always do a scan on FC or iSCSI
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   254
     echo "- - -" > /sys/class/scsi_host/host$host/scan 2> /dev/null;
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   255
     [ -z $forcerescan ] && channelsearch=""
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   256
     idsearch=""
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   257
-- 
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   258
1.7.4.4
8dfd8bd38819 7193528 Move sg3_utils to the Userland consolidation
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   259