PSARC 2012/277 sg3 utilities 1.33
authorWenbo Li<Wenbo.Li@Oracle.COM>
Fri, 07 Sep 2012 07:37:33 -0700
changeset 967 92027d7f7d91
parent 966 72141af4869b
child 968 4639691236c7
PSARC 2012/277 sg3 utilities 1.33 7187465 update sg3_utils to latest version 1.33
components/sg3_utils/Makefile
components/sg3_utils/patches/rescan-scsi-bus-fixes.patch
components/sg3_utils/sg3_utils.p5m
--- a/components/sg3_utils/Makefile	Thu Sep 06 07:49:43 2012 -0700
+++ b/components/sg3_utils/Makefile	Fri Sep 07 07:37:33 2012 -0700
@@ -26,23 +26,14 @@
 include ../../make-rules/shared-macros.mk
 
 COMPONENT_NAME=		sg3_utils
-COMPONENT_VERSION=	1.28
+COMPONENT_VERSION=	1.33
 COMPONENT_PROJECT_URL=	http://sg.danny.cz/sg/sg3_utils.html
 COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
 COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tgz
 COMPONENT_ARCHIVE_HASH= \
-    sha256:da8bd627a6246b709e2a0321fa9d5ca09a33354a1ae40c74cd37efb69b9f8118
+    sha256:3034a4e798404cc963fc46437b0ceeb0edc635e02471ab13aa18acd8b716a27b
 COMPONENT_ARCHIVE_URL=	http://sg.danny.cz/sg/p/$(COMPONENT_ARCHIVE)
 
-COMPONENT_ARCHIVE_1 =	rescan-scsi-bus.sh-1.35
-COMPONENT_ARCHIVE_HASH_1 = \
-    sha256:324630d65ef85480f3fc57e8c1648dba2c79fa1927e26e6dfd1b64c7b8aba0b1
-COMPONENT_ARCHIVE_URL_1 = http://www.garloff.de/kurt/linux/rescan-scsi-bus.sh-1.35
-
-COMPONENT_POST_UNPACK_ACTION = \
-	$(CP) $(COMPONENT_DIR)/rescan-scsi-bus.sh-1.35 \
-		$(COMPONENT_SRC)/rescan-scsi-bus.sh
-
 include ../../make-rules/prep.mk
 include ../../make-rules/configure.mk
 include ../../make-rules/ips.mk
--- a/components/sg3_utils/patches/rescan-scsi-bus-fixes.patch	Thu Sep 06 07:49:43 2012 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,259 +0,0 @@
-From 38842b5eafcd85bc91d96e2b2d0b99ea8864d907 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
-Date: Thu, 14 Jan 2010 12:50:05 +0100
-Subject: [PATCH 1/5] netapp - fixes in doreportlun
-
----
- rescan-scsi-bus.sh |   64 ++++++++++++++++++++++++++++++++++------------------
- 1 files changed, 42 insertions(+), 22 deletions(-)
-
-diff --git a/rescan-scsi-bus.sh b/rescan-scsi-bus.sh
-index af1f843..8d52e39 100644
---- a/rescan-scsi-bus.sh
-+++ b/rescan-scsi-bus.sh
-@@ -371,38 +371,58 @@ dolunscan()
- # Perform report lun scan
- doreportlun()
- {
--  lun=0
-+  lun=
-   SCSISTR=
--  devnr="$host $channel $id $lun"
--  echo "Scanning for device $devnr ..."
--  #printf "${yellow}OLD: $norm"
--  testexist -q
--  if test -z "$SCSISTR"; then
--    # Device does not exist, try to add
--    #printf "\r${green}NEW: $norm"
--    if test -e /sys/class/scsi_host/host${host}/scan; then
--      echo "$channel $id $lun" > /sys/class/scsi_host/host${host}/scan 2> /dev/null
--    else
--      echo "scsi add-single-device $devnr" > /proc/scsi/scsi
--    fi
-+  for dev in /sys/class/scsi_device/${host}:${channel}:${id}:*; do
-+        if [ -d "$dev" ]; then
-+                lun=${dev##*:}
-+                break
-+        else
-+                continue
-+        fi
-+  done
-+  #If not a single LUN is present then assign lun=0
-+  if [ -z $lun ]; then
-+    lun=0
-+    devnr="$host $channel $id $lun"
-+    echo "Scanning for device $devnr ..."
-+    printf "${yellow}OLD: $norm"
-     testexist -1
-     if test -z "$SCSISTR"; then
--      # Device not present
--      printf "\r\x1b[A";
--      lunsearch=
--      return
-+      # Device does not exist, try to add
-+      printf "\r${green}NEW: $norm"
-+      if test -e /sys/class/scsi_host/host${host}/scan; then
-+        echo "$channel $id $lun" > /sys/class/scsi_host/host${host}/scan 2> /dev/null
-+      else
-+        echo "scsi add-single-device $devnr" > /proc/scsi/scsi
-+      fi
-+      testexist
-+      if test -z "$SCSISTR"; then
-+        # Device not present
-+        printf "\r\x1b[A";
-+        lunsearch=
-+        return
-+      fi
-     fi
-     #testonline
-   fi
--  lunsearch=`getluns`
-+  flag=0
-+  lun_search="`getluns`"
-+  # Set flag=1 if all the LUNs are removed
-+  if [ "${#lun_search}" = "1" ]; then
-+    flag=1
-+  fi
-   lunremove=
-   # Check existing luns
-   for dev in /sys/class/scsi_device/${host}:${channel}:${id}:*; do
-     [ -d "$dev" ] || continue
-     lun=${dev##*:}
-+    if [ "$flag" = "1" ]; then
-+      lunremove="$lunremove $lun"
-+    fi
-     newsearch=
--    oldsearch="$lunsearch"
--    for tmplun in $lunsearch; do
-+    oldsearch="$lun_search"
-+    for tmplun in $lun_search; do
-       if test $tmplun -eq $lun ; then
- 	dolunscan
-       else
-@@ -413,10 +433,10 @@ doreportlun()
- 	# Stale lun
- 	lunremove="$lunremove $lun"
-     fi
--    lunsearch="$newsearch"
-+    lun_search="$newsearch"
-   done
-   # Add new ones and check stale ones
--  for lun in $lunsearch $lunremove; do
-+  for lun in $lun_search $lunremove; do
-     dolunscan
-   done
- }
--- 
-1.6.6.1
-
-
-From 0e94e0c27d575f18a57938b9d98dfe02d8c11eb9 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
-Date: Thu, 14 Jan 2010 12:50:59 +0100
-Subject: [PATCH 2/5] netapp - LIP is not required to do a scan on FC
-
----
- rescan-scsi-bus.sh |    3 +--
- 1 files changed, 1 insertions(+), 2 deletions(-)
-
-diff --git a/rescan-scsi-bus.sh b/rescan-scsi-bus.sh
-index 8d52e39..13e9283 100644
---- a/rescan-scsi-bus.sh
-+++ b/rescan-scsi-bus.sh
-@@ -587,11 +587,10 @@ declare -i rmvd=0
- for host in $hosts; do
-   echo -n "Scanning host $host "
-   if test -e /sys/class/fc_host/host$host ; then
--    # It's pointless to do a target scan on FC
-     if test -n "$lipreset" ; then
-       echo 1 > /sys/class/fc_host/host$host/issue_lip 2> /dev/null;
--      echo "- - -" > /sys/class/scsi_host/host$host/scan 2> /dev/null;
-     fi
-+    echo "- - -" > /sys/class/scsi_host/host$host/scan 2> /dev/null;
-     channelsearch=""
-     idsearch=""
-   fi
--- 
-1.6.6.1
-
-
-From c3b67a28289bb010d141e172a184982c40e2fff2 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
-Date: Thu, 14 Jan 2010 12:51:31 +0100
-Subject: [PATCH 3/5] space before getluns call is required
-
----
- rescan-scsi-bus.sh |    2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/rescan-scsi-bus.sh b/rescan-scsi-bus.sh
-index 13e9283..26a9853 100644
---- a/rescan-scsi-bus.sh
-+++ b/rescan-scsi-bus.sh
-@@ -407,7 +407,7 @@ doreportlun()
-     #testonline
-   fi
-   flag=0
--  lun_search="`getluns`"
-+  lun_search=" `getluns`"
-   # Set flag=1 if all the LUNs are removed
-   if [ "${#lun_search}" = "1" ]; then
-     flag=1
--- 
-1.6.6.1
-
-
-From 5c10b085e2e83f371eddee16937157b0e7f63d5b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
-Date: Thu, 14 Jan 2010 15:15:34 +0100
-Subject: [PATCH 4/5] wait for device
-
-When a device reports "unit attention" state after calling sg_turs, then wait until the device comes online or a timeout is reached.
----
- rescan-scsi-bus.sh |    8 ++++++--
- 1 files changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/rescan-scsi-bus.sh b/rescan-scsi-bus.sh
-index 26a9853..23fba7d 100644
---- a/rescan-scsi-bus.sh
-+++ b/rescan-scsi-bus.sh
-@@ -195,8 +195,12 @@ testonline ()
-   if test ! -x /usr/bin/sg_turs; then return 0; fi
-   sgdevice
-   if test -z "$SGDEV"; then return 0; fi
--  sg_turs /dev/$SGDEV >/dev/null 2>&1
--  RC=$?
-+  for t in 1 2 3 4 5; do
-+    sg_turs /dev/$SGDEV >/dev/null 2>&1
-+    RC=$?
-+    [ $RC -ne 6 ] && break
-+    sleep $t
-+  done
-   # echo -e "\e[A\e[A\e[A${yellow}Test existence of $SGDEV = $RC ${norm} \n\n\n"
-   if test $RC = 1; then return $RC; fi
-   # OK, device online, compare INQUIRY string
--- 
-1.6.6.1
-
-
-From ab78298b801aa1afdbaa7091a9e4aecdf8d89d2c Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
-Date: Fri, 25 Jun 2010 11:23:28 +0200
-Subject: [PATCH 5/5] accept user specified channel list when scanning FC host
-
-Allow the user to specify channels to scan on FC host when trying to find
-a first LUN. Option --forcerescan is used for that and when it's not given
-it defaults to the old behaviour when it gets available channels from
-/sys/class/scsi_device
----
- rescan-scsi-bus.sh |    2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/rescan-scsi-bus.sh b/rescan-scsi-bus.sh
-index 23fba7d..a7fd1f3 100644
---- a/rescan-scsi-bus.sh
-+++ b/rescan-scsi-bus.sh
-@@ -595,7 +595,7 @@ for host in $hosts; do
-       echo 1 > /sys/class/fc_host/host$host/issue_lip 2> /dev/null;
-     fi
-     echo "- - -" > /sys/class/scsi_host/host$host/scan 2> /dev/null;
--    channelsearch=""
-+    [ -z $forcerescan ] && channelsearch=""
-     idsearch=""
-   fi
-   [ -n "$channelsearch" ] && echo -n "channels $channelsearch "
--- 
-1.6.6.1
-
-From 857456759088a92cf9cd2dbfaa24b5bf9cb0829e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
-Date: Wed, 22 Sep 2010 15:33:00 +0200
-Subject: [PATCH] issue scan command also for iSCSI
-
-iSCSI devices behave like FC ones, so they need to issue the scan command
-first to work when there is no LUN==0 mapped.
----
- rescan-scsi-bus.sh |    5 +++--
- 1 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/rescan-scsi-bus.sh b/rescan-scsi-bus.sh
-index a7fd1f3..1b9ea7d 100644
---- a/rescan-scsi-bus.sh
-+++ b/rescan-scsi-bus.sh
-@@ -590,10 +590,11 @@ declare -i found=0
- declare -i rmvd=0
- for host in $hosts; do
-   echo -n "Scanning host $host "
--  if test -e /sys/class/fc_host/host$host ; then
--    if test -n "$lipreset" ; then
-+  if test -e /sys/class/fc_host/host$host -o -e /sys/class/iscsi_host/host$host ; then
-+    if test -e /sys/class/fc_host/host$host -a -n "$lipreset" ; then
-       echo 1 > /sys/class/fc_host/host$host/issue_lip 2> /dev/null;
-     fi
-+    # always do a scan on FC or iSCSI
-     echo "- - -" > /sys/class/scsi_host/host$host/scan 2> /dev/null;
-     [ -z $forcerescan ] && channelsearch=""
-     idsearch=""
--- 
-1.7.4.4
-
--- a/components/sg3_utils/sg3_utils.p5m	Thu Sep 06 07:49:43 2012 -0700
+++ b/components/sg3_utils/sg3_utils.p5m	Fri Sep 07 07:37:33 2012 -0700
@@ -31,8 +31,7 @@
     value='Collection of utilities for devices that use the SCSI command set. Includes utilities to copy data based on "dd" syntax and semantics (called sg_dd, sgp_dd and sgm_dd); check INQUIRY data and VPD pages (sg_inq); check mode and log pages (sginfo, sg_modes and sg_logs); spin up and down disks (sg_start); do self tests (sg_senddiag); and various other functions. Warning: Some of these tools access the internals of your system and the incorrect usage of them may render your system inoperable.'
 set name=info.classification \
     value="org.opensolaris.category.2008:Applications/System Utilities"
-set name=info.source-url value=http://sg.danny.cz/sg/p/sg3_utils-1.28.tgz \
-    value=http://www.garloff.de/kurt/linux/rescan-scsi-bus.sh-1.35
+set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
 set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
 set name=org.opensolaris.arc-caseid value=PSARC/2009/029
 set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
@@ -45,6 +44,7 @@
 file sg3_utils-prof_attr path=etc/security/prof_attr.d/system:storage:sg3_utils
 dir  path=usr
 dir  path=usr/bin
+file path=usr/bin/sg_decode_sense
 file path=usr/bin/sg_format
 file path=usr/bin/sg_get_config
 file path=usr/bin/sg_get_lba_status
@@ -63,10 +63,12 @@
 file path=usr/bin/sg_read_long
 file path=usr/bin/sg_readcap
 file path=usr/bin/sg_reassign
+file path=usr/bin/sg_referrals
 file path=usr/bin/sg_requests
 file path=usr/bin/sg_rmsn
 file path=usr/bin/sg_rtpg
 file path=usr/bin/sg_safte
+file path=usr/bin/sg_sanitize
 file path=usr/bin/sg_sat_identify
 file path=usr/bin/sg_sat_phy_event
 file path=usr/bin/sg_sat_set_features
@@ -91,6 +93,7 @@
 dir  path=usr/share/man
 dir  path=usr/share/man/man1m
 file path=usr/share/man/man1m/sg3_utils.1m
+file path=usr/share/man/man1m/sg_decode_sense.1m
 file path=usr/share/man/man1m/sg_format.1m
 file path=usr/share/man/man1m/sg_get_config.1m
 file path=usr/share/man/man1m/sg_get_lba_status.1m
@@ -109,10 +112,12 @@
 file path=usr/share/man/man1m/sg_read_long.1m
 file path=usr/share/man/man1m/sg_readcap.1m
 file path=usr/share/man/man1m/sg_reassign.1m
+file path=usr/share/man/man1m/sg_referrals.1m
 file path=usr/share/man/man1m/sg_requests.1m
 file path=usr/share/man/man1m/sg_rmsn.1m
 file path=usr/share/man/man1m/sg_rtpg.1m
 file path=usr/share/man/man1m/sg_safte.1m
+file path=usr/share/man/man1m/sg_sanitize.1m
 file path=usr/share/man/man1m/sg_sat_identify.1m
 file path=usr/share/man/man1m/sg_sat_phy_event.1m
 file path=usr/share/man/man1m/sg_sat_set_features.1m