--- sg3_utils/scripts/rescan-scsi-bus.sh +++ sg3_utils/scripts/rescan-scsi-bus.sh @@ -222,7 +222,7 @@ sgdevice () [ $? -eq 1 ] && return fi if ! echo "$DRV" | grep -q 'drivers: sg'; then - modprobe sg + $MODPROBE sg fi sgdevice24 if [ $repdevstat = 0 ]; then @@ -452,20 +452,20 @@ getluns() udevadm_settle() { local tmo=60 - if [ -x /sbin/udevadm ] ; then + if [ -x "$UDEVADM" ] ; then print_and_scroll_back " Calling udevadm settle (can take a while) " # Loop for up to 60 seconds if sd devices still are settling.. # This allows us to continue if udev events are stuck on multipaths in recovery mode while [ $tmo -gt 0 ] ; do - if ! /sbin/udevadm settle --timeout=1 | egrep -q sd[a-z]+ ; then + if ! "$UDEVADM" settle --timeout=1 | egrep -q sd[a-z]+ ; then break; fi let tmo=$tmo-1 done white_out - elif [ -x /sbin/udevsettle ] ; then + elif [ -x "$UDEVSETTLE" ] ; then print_and_scroll_back " Calling udevsettle (can take a while) " - /sbin/udevsettle + "$UDEVSETTLE" white_out else sleep 0.02 @@ -799,7 +799,7 @@ findremapped() # Trigger udev to update the info echo -n "Triggering udev to update device information... " - /sbin/udevadm trigger + "$UDEVADM" trigger udevadm_settle 2>&1 /dev/null echo "Done" @@ -996,11 +996,11 @@ reloadmpaths() resizempaths() { - local mpath + local mpath multipathd=multipathd for mpath in $mpaths ; do echo -n "Resizing multipath map $mpath ..." - multipathd -k"resize map $mpath" + $multipathd -k"resize map $mpath" let updated+=1 done } @@ -1169,7 +1169,7 @@ if [ ! -d /sys/class/scsi_host/ ] && [ ! -d /proc/scsi/ ] ; then fi # Make sure sg is there -modprobe sg >/dev/null 2>&1 +$MODPROBE sg >/dev/null 2>&1 if [ -x /usr/bin/sg_inq ] ; then sg_version=$(sg_inq -V 2>&1 | cut -d " " -f 3) @@ -1290,6 +1290,9 @@ DMSETUP=$(which dmsetup) [ -z "$DMSETUP" ] && flush= && mp_enable= MULTIPATH=$(which multipath) [ -z "$MULTIPATH" ] && flush= && mp_enable= +UDEVADM=$(which udevadm 2>/dev/null) +UDEVSETTLE=$(which udevsettle 2>/dev/null) +MODPROBE=modprobe echo -n "Scanning SCSI subsystem for new devices" [ -z "$flush" ] || echo -n ", flush failed multipath devices," @@ -1367,7 +1370,7 @@ if [ -n "$mp_enable" ] && [ $rmvd_found -gt 0 ] ; then flushmpaths 1 fi if [ $found -gt 0 ] ; then - /sbin/udevadm trigger --sysname-match=sd* + "$UDEVADM" trigger --sysname-match=sd* udevadm_settle if [ -x "$MULTIPATH" ] ; then echo "Trying to discover new multipath mappings for newly discovered devices... "