Fix rescan-scsi-bus.sh -r remove valid disks

Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
This commit is contained in:
Wenchao Hao 2022-02-15 15:51:12 +08:00
parent db922bfd22
commit e239ad2a49
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From fc72119f67614152d635452856ec9894474599e4 Mon Sep 17 00:00:00 2001
From: Douglas Gilbert <dgilbert@interlog.com>
Date: Mon, 3 Jan 2022 17:49:24 +0000
Subject: [PATCH] rescan-scsi-bus.sh: apply fix for '-r' from
https://github.com/doug-gilbert/sg3_utils/pull/10/ from Nitin U. Yewale,
broken by rev 867
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@929 6180dd3e-e324-4e3e-922d-17de1ae2f315
Conflict: only keep rescan-scsi-bus's changes, change of following files
are removed:
BSD_LICENSE
CREDITS
ChangeLog
debian/changelog
doc/rescan-scsi-bus.sh.8
doc/sg3_utils.8
sg3_utils.spec
---
scripts/rescan-scsi-bus.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index 16a7642..57fbe66 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -307,7 +307,13 @@ testonline ()
IPREV=$(echo "$INQ" | grep 'Product revision level:' | sed 's/^[^:]*: \(.*\)$/\1/')
STR=$(printf " Vendor: %-08s Model: %-16s Rev: %-4s" "$IVEND" "$IPROD" "$IPREV")
IPTYPE=$(echo "$INQ" | sed -n 's/.* Device_type=\([0-9]*\) .*/\1/p')
+ if [ -z "$IPTYPE" ]; then
+ IPTYPE=$(echo "$INQ" | sed -n 's/.* PDT=\([0-9]*\) .*/\1/p')
+ fi
IPQUAL=$(echo "$INQ" | sed -n 's/ *PQual=\([0-9]*\) Device.*/\1/p')
+ if [ -z "$IPQUAL" ] ; then
+ IPQUAL=$(echo "$INQ" | sed -n 's/ *PQual=\([0-9]*\) PDT.*/\1/p')
+ fi
if [ "$IPQUAL" != 0 ] ; then
[ -z "$IPQUAL" ] && IPQUAL=3
[ -z "$IPTYPE" ] && IPTYPE=31
--
2.34.1

View File

@ -1,6 +1,6 @@
Name: sg3_utils
Version: 1.46
Release: 2
Release: 3
Summary: Utilities that send SCSI commands to devices.
License: GPL-2.0-or-later AND BSD
URL: http://sg.danny.cz/sg/sg3_utils.html
@ -12,6 +12,7 @@ Patch2: 0002-bugfix-sg3_utils-fix-syntax-error.patch
Patch3: 0003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch
Patch4: 0004-sg3_utils-fix-memset-coredump.patch
Patch5: 0005-sg3_utils-rescan-scsi-bus-list-all-LUNs-in-one-line.patch
Patch6: 0006-rescan-scsi-bus.sh-apply-fix-for-r-from-https-github.patch
Provides: %{name}-libs
Obsoletes: %{name}-libs
@ -75,6 +76,9 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la
%{_mandir}/man8/*
%changelog
* Tue Feb 15 2022 Wenchao Hao <haowenchao@huawei.com> -1.46-3
- Fix rescan-scsi-bus.sh -r remove valid disks
* Sat Jan 29 2022 Zhiqiang Liu <liuzhiqiang26@huawei.com> -1.46-2
- rescan scsi bus list all LUNs in one line