OBS User unknown 2008-07-16 20:24:47 +00:00 committed by Git OBS Bridge
parent 30c6863fe6
commit e7205e1e7f
3 changed files with 28 additions and 10 deletions

View File

@ -188,7 +188,7 @@ testonline ()
# echo -e "\e[A\e[A\e[A${yellow}Test existence of $SGDEV = $RC ${norm} \n\n\n" # 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 if test $RC = 1; then return $RC; fi
# OK, device online, compare INQUIRY string # OK, device online, compare INQUIRY string
INQ=`sg_inq -36 /dev/$SGDEV` INQ=`sg_inq $sg_len_arg /dev/$SGDEV`
IVEND=`echo "$INQ" | grep 'Vendor identification:' | sed 's/^[^:]*: \(.*\)$/\1/'` IVEND=`echo "$INQ" | grep 'Vendor identification:' | sed 's/^[^:]*: \(.*\)$/\1/'`
IPROD=`echo "$INQ" | grep 'Product identification:' | sed 's/^[^:]*: \(.*\)$/\1/'` IPROD=`echo "$INQ" | grep 'Product identification:' | sed 's/^[^:]*: \(.*\)$/\1/'`
IPREV=`echo "$INQ" | grep 'Product revision level:' | sed 's/^[^:]*: \(.*\)$/\1/'` IPREV=`echo "$INQ" | grep 'Product revision level:' | sed 's/^[^:]*: \(.*\)$/\1/'`
@ -205,12 +205,12 @@ testonline ()
TMPSTR=`echo "$SCSISTR" | grep 'Vendor:'` TMPSTR=`echo "$SCSISTR" | grep 'Vendor:'`
if [ "$TMPSTR" != "$STR" ]; then if [ "$TMPSTR" != "$STR" ]; then
echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nfrom:${SCSISTR#* } \nto: $STR ${norm}\n\n\n" echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nfrom:${SCSISTR#* } \nto: $STR ${norm}\n\n\n"
return 1 return 0
fi fi
TMPSTR=`echo "$SCSISTR" | sed -n 's/.*Type: *\(.*\) *ANSI.*/\1/p'` TMPSTR=`echo "$SCSISTR" | sed -n 's/.*Type: *\(.*\) *ANSI.*/\1/p'`
if [ $TMPSTR != $TYPE ] ; then if [ $TMPSTR != $TYPE ] ; then
echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nfrom:${TMPSTR} \nto: $TYPE ${norm}\n\n\n" echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nfrom:${TMPSTR} \nto: $TYPE ${norm}\n\n\n"
return 1 return 0
fi fi
return $RC return $RC
} }
@ -297,7 +297,8 @@ dolunscan()
# Device exists: Test whether it's still online # Device exists: Test whether it's still online
# (testonline returns 1 if it's gone or has changed) # (testonline returns 1 if it's gone or has changed)
testonline testonline
if test $? = 1 -o ! -z "$forceremove"; then RC=$?
if test $RC = 1 -o ! -z "$forceremove"; then
echo -en "\r\e[A\e[A\e[A${red}REM: " echo -en "\r\e[A\e[A\e[A${red}REM: "
echo "$SCSISTR" | head -n1 echo "$SCSISTR" | head -n1
echo -e "${norm}\e[B\e[B" echo -e "${norm}\e[B\e[B"
@ -311,6 +312,11 @@ dolunscan()
echo "scsi add-single-device $devnr" > /proc/scsi/scsi echo "scsi add-single-device $devnr" > /proc/scsi/scsi
fi fi
fi fi
if test $RC = 0 ; then
if test -e /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device; then
echo 1 > /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/rescan
fi
fi
printf "\r\x1b[A\x1b[A\x1b[A${yellow}OLD: $norm" printf "\r\x1b[A\x1b[A\x1b[A${yellow}OLD: $norm"
testexist testexist
if test -z "$SCSISTR"; then if test -z "$SCSISTR"; then
@ -374,10 +380,7 @@ doreportlun()
oldsearch="$lunsearch" oldsearch="$lunsearch"
for tmplun in $lunsearch; do for tmplun in $lunsearch; do
if test $tmplun -eq $lun ; then if test $tmplun -eq $lun ; then
# Optimization: don't scan lun 0 again
if [ $lun -ne 0 ]; then
dolunscan dolunscan
fi
else else
newsearch="$newsearch $tmplun" newsearch="$newsearch $tmplun"
fi fi
@ -471,11 +474,19 @@ fi
# Make sure sg is there # Make sure sg is there
modprobe sg >/dev/null 2>&1 modprobe sg >/dev/null 2>&1
sg_version=$(sg_inq -V 2>&1 | cut -d " " -f 3)
sg_version=${sg_version##0.}
if [ "$sg_version" -lt 70 ] ; then
sg_len_arg="-36"
else
sg_len_arg="--len=36"
fi
# defaults # defaults
unsetcolor unsetcolor
lunsearch="" lunsearch=""
idsearch=`seq 0 7` idsearch=`seq 0 7`
channelsearch="0" channelsearch=""
remove= remove=
forceremove= forceremove=
optscan=1 optscan=1

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Jul 16 09:55:33 CEST 2008 - hare@suse.de
- Use correct length parameter for sg_inq (bnc#363438)
------------------------------------------------------------------- -------------------------------------------------------------------
Fri May 23 10:22:31 CEST 2008 - hare@suse.de Fri May 23 10:22:31 CEST 2008 - hare@suse.de

View File

@ -20,7 +20,7 @@ Provides: scsi
Obsoletes: scsi <= 1.7_2.38_1.25_0.19_1.02_0.93 Obsoletes: scsi <= 1.7_2.38_1.25_0.19_1.02_0.93
AutoReqProv: on AutoReqProv: on
Version: 1.25 Version: 1.25
Release: 9 Release: 16
Summary: A collection of tools that send SCSI commands to devices Summary: A collection of tools that send SCSI commands to devices
Source: http://sg.torque.net/sg/p/sg3_utils-%{sgver}.tar.bz2 Source: http://sg.torque.net/sg/p/sg3_utils-%{sgver}.tar.bz2
Source2: http://www.garloff.de/kurt/linux/rescan-scsi-bus.sh Source2: http://www.garloff.de/kurt/linux/rescan-scsi-bus.sh
@ -210,6 +210,8 @@ test ! -z "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROO
rm -rf $RPM_BUILD_DIR/sg3_utils-%{sgver} rm -rf $RPM_BUILD_DIR/sg3_utils-%{sgver}
%changelog %changelog
* Wed Jul 16 2008 hare@suse.de
- Use correct length parameter for sg_inq (bnc#363438)
* Fri May 23 2008 hare@suse.de * Fri May 23 2008 hare@suse.de
- Use 'Provides' to clean update dependency - Use 'Provides' to clean update dependency
* Fri May 09 2008 schwab@suse.de * Fri May 09 2008 schwab@suse.de