aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2022-04-21 03:54:07 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2022-04-21 03:54:07 +0000
commit7885dc0ac20062d6e7bb9aa2cc1d0197fcc865e0 (patch)
tree98817a7265f9720111b2f3976ddfd33d4f19a8a5
parent8cd2200ba1758cd127a1b95ab1808cde4f56713c (diff)
downloadsg3_utils-7885dc0ac20062d6e7bb9aa2cc1d0197fcc865e0.tar.gz
https://github.com/doug-gilbert/sg3_utils/pull/17 applied with tweaks: add timeout parameter
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@946 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog4
-rw-r--r--doc/rescan-scsi-bus.sh.818
-rwxr-xr-xscripts/rescan-scsi-bus.sh11
3 files changed, 22 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 0ca8cb77..22234747 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,7 @@ Each utility has its own version number, date of last change and
some description at the top of its ".c" file. All utilities in the main
directory have their own "man" pages. There is also a sg3_utils man page.
-Changelog for pre-release sg3_utils-1.48 [20220420] [svn: r945]
+Changelog for pre-release sg3_utils-1.48 [20220420] [svn: r946]
- sg_z_act_query: new utility for sending either a
Zone activate or Zone query command
- sg_rep_density: new utility for decoding the response of
@@ -16,6 +16,8 @@ Changelog for pre-release sg3_utils-1.48 [20220420] [svn: r945]
each LUN in the default (no option) output
- rev 815 changed the order of listing hosts from
numeric to alphabetical, change it back to numeric
+ - https://github.com/doug-gilbert/sg3_utils/pull/17
+ applied with tweaks: add timeout parameter
- sg_rep_zones: add Report zone starting LBA granularity
field in REPORT ZONES response [zbc2r12]
- add --brief option, show part of header and last
diff --git a/doc/rescan-scsi-bus.sh.8 b/doc/rescan-scsi-bus.sh.8
index b5e84cb5..c91b1f38 100644
--- a/doc/rescan-scsi-bus.sh.8
+++ b/doc/rescan-scsi-bus.sh.8
@@ -1,4 +1,4 @@
-.TH RESCAN\-SCSI\-BUS.SH "1" "January 2022" "rescan\-scsi\-bus.sh" "User Commands"
+.TH RESCAN\-SCSI\-BUS.SH "1" "Aprile 2022" "rescan\-scsi\-bus.sh" "User Commands"
.SH NAME
rescan-scsi-bus.sh \- script to add and remove SCSI devices without rebooting
.SH SYNOPSIS
@@ -7,12 +7,12 @@ rescan-scsi-bus.sh \- script to add and remove SCSI devices without rebooting
[\fI\-\--channels=CLIST\fR] [\fI\-\-color\fR] [\fI\-d\fR] [\fI\-\-flush\fR]
[\fI\-f\fR] [\fI\-\-forceremove\fR] [\fI\-\-forcerescan\fR] [\fI\-\-help\fR]
[\fI\-\-hosts=HLIST\fR] [\fI\-\-ids=TLIST\fR] [\fI\-\-ignore\-rev\fR]
-[\fI\-\-issue\-lip\fR] [\fI\-i\fR] [\fI\-\-issue\-lip\-wait=SECS\fR] [\fI\-I SECS\fR]
-[\fI\-l\fR]
-[\fI\-L NUM\fR] [\fI\-\-largelun\fR] [\fI\-\-luns=LLIST\fR] [\fI\-m\fR]
-[\fI\-\-multipath\fR] [\fI\-\-nooptscan\fR] [\fI\-\-nosync\fR]
-[\fI\-\-remove\fR] [\fI\-\-removelun2\fR] [\fI\-\-resize\fR]
-[\fI\-\-sparselun\fR] [\fI\-\-sync\fR] [\fI\-\-update\fR] [\fI\-\-version\fR]
+[\fI\-\-issue\-lip\fR] [\fI\-i\fR] [\fI\-\-issue\-lip\-wait=SECS\fR]
+[\fI\-I SECS\fR] [\fI\-l\fR] [\fI\-L NUM\fR] [\fI\-\-largelun\fR]
+[\fI\-\-luns=LLIST\fR] [\fI\-m\fR] [\fI\-\-multipath\fR] [\fI\-\-nooptscan\fR]
+[\fI\-\-nosync\fR] [\fI\-\-remove\fR] [\fI\-\-removelun2\fR]
+[\fI\-\-resize\fR] [\fI\-\-sparselun\fR] [\fI\-\-sync\fR]
+[\fI\-\-timeout=SECS\fR] [\fI\-\-update\fR] [\fI\-\-version\fR]
[\fI\-\-wide\fR] [\fIHOST1 \fR[\fIHOST2 \fR...]]
.SH OPTIONS
Option are ordered by their long name. Those without a long name are ordered
@@ -100,6 +100,10 @@ tell kernel to support sparse LUN numbering
\fB\-\-sync\fR
issue a sync [default: sync if remove]
.TP
+\fB\-t\fR, \fB\-\-timeout=SECS\fR
+timeout for testing if device is online. Test is skipped if 0 [default:
+30 (seconds)]
+.TP
\fB\-u\fR, \fB\-\-update\fR
look for existing disks that have been remapped
.TP
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index 862badaa..09e22a4a 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -4,7 +4,7 @@
# (c) 2006--2022 Hannes Reinecke, GNU GPL v2 or later
# $Id: rescan-scsi-bus.sh,v 1.57 2012/03/31 14:08:48 garloff Exp $
-VERSION="20220117"
+VERSION="20220420"
SCAN_WILD_CARD=4294967295
setcolor ()
@@ -272,7 +272,7 @@ testonline ()
RC=$?
# Handle in progress of becoming ready and unit attention
- while [ $RC = 2 -o $RC = 6 ] && [ $ctr -le 30 ] ; do
+ while [ $RC = 2 -o $RC = 6 ] && [ $ctr -lt $timeout ] ; do
if [ $RC = 2 ] && [ "$RMB" != "1" ] ; then
echo -n "."
let LN+=1
@@ -1128,6 +1128,7 @@ if [ "@$1" = @--help ] || [ "@$1" = @-h ] || [ "@$1" = "@-?" ] ; then
echo " -m update multipath devices [default: disabled]"
echo " -r enables removing of devices [default: disabled]"
echo " -s look for resized disks and reload associated multipath devices, if applicable"
+ echo " -t SECS timeout for testing if device is online. Test is skipped if 0 [default: 30]"
echo " -u look for existing disks that have been remapped"
echo " -V print version date then exit"
echo " -w scan for target device IDs 0--15 [default: 0--7]"
@@ -1153,6 +1154,7 @@ if [ "@$1" = @--help ] || [ "@$1" = @-h ] || [ "@$1" = "@-?" ] ; then
echo "--resize: same as -s"
echo "--sparselun: Tell kernel to support sparse LUN numbering"
echo "--sync/nosync: Issue a sync / no sync [default: sync if remove]"
+ echo "--timeout=SECS: same as -t"
echo "--update: same as -u"
echo "--version: same as -V"
echo "--wide: same as -w"
@@ -1213,6 +1215,7 @@ sync=1
existing_targets=1
mp_enable=
lipreset=-1
+timeout=30
declare -i scan_flags=0
ignore_rev=0
@@ -1232,6 +1235,7 @@ while [ ! -z "$opt" ] && [ -z "${opt##-*}" ] ; do
m) mp_enable=1 ;;
r) remove=1 ;;
s) resize=1; mp_enable=1 ;;
+ t) timeout=$2; shift ;;
u) update=1 ;;
w) opt_idsearch=$(seq -s ' ' 0 15) ;;
-alltargets) existing_targets=;;
@@ -1245,7 +1249,7 @@ while [ ! -z "$opt" ] && [ -z "${opt##-*}" ] ; do
-ids=*) arg=${opt#-ids=}; opt_idsearch=$(expandlist "$arg") ; filter_ids=1;;
-ignore-rev) ignore_rev=1;;
-issue-lip) lipreset=0 ;;
- -issue-lip-wait) lipreset=${opt#-issue-lip-wait=};;
+ -issue-lip-wait=*) lipreset=${opt#-issue-lip-wait=};;
-largelun) scan_flags=$((scan_flags|0x200)) ;;
-luns=*) arg=${opt#-luns=}; lunsearch=$(expandlist "$arg") ;;
-multipath) mp_enable=1 ;;
@@ -1254,6 +1258,7 @@ while [ ! -z "$opt" ] && [ -z "${opt##-*}" ] ; do
-remove) remove=1 ;;
-reportlun2) scan_flags=$((scan_flags|0x20000)) ;;
-resize) resize=1;;
+ -timeout=*) timeout=${opt#-timeout=};;
-sparselun) scan_flags=$((scan_flags|0x40)) ;;
-sync) sync=2 ;;
-update) update=1;;