mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Make the CTL tests more resilient
Fix the find_device function to work regardless of whether "camcontrol
devlist" lists the da device first and the pass device second or vice
versa. On FreeBSD 14 and 15 it apparently always lists da first. But
on 13 it can do it in either order.
Sponsored by: ConnectWise
Reviewed by: emaste, markj, #cam
Differential Revision: https://reviews.freebsd.org/D47446
(cherry picked from commit b032be711c)
This commit is contained in:
parent
6203d08e7a
commit
23b2704059
1 changed files with 8 additions and 1 deletions
|
|
@ -47,7 +47,14 @@ find_device() {
|
|||
ctladm port -o on -p 0 >/dev/null
|
||||
HEXLUN=`printf %x $LUN`
|
||||
while true; do
|
||||
dev=`camcontrol devlist | awk -v lun=$HEXLUN '/FREEBSD CTL/ && $9==lun {split($10, fields, /[,]/); print fields[1];}' | sed 's:[()]::'`
|
||||
dev=`camcontrol devlist | awk -v lun=$HEXLUN '
|
||||
/FREEBSD CTL.*,pass/ && $9==lun {
|
||||
split($10, fields, /[,]/); print fields[1];
|
||||
}
|
||||
/FREEBSD CTL.*\(pass/ && $9==lun {
|
||||
split($10, fields, /[,]/); print fields[2];
|
||||
}
|
||||
' | sed 's:[()]::'`
|
||||
if [ -z "$dev" -o ! -c /dev/$dev ]; then
|
||||
retries=$(( $retries - 1 ))
|
||||
if [ $retries -eq 0 ]; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue