95iscsi: parse output from iscsiadm correctly

Due to some obsure reason the IFS parameter is not set correctly
when evaluating get_ibft_mod(). So change the parsing to not rely
on IFS altogether.

References: bnc#886199

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
master
Hannes Reinecke 2014-12-11 15:46:19 +01:00 committed by Harald Hoyer
parent 206345ce9b
commit cd72830807
1 changed files with 7 additions and 6 deletions

View File

@ -30,15 +30,16 @@ check() {


get_ibft_mod() { get_ibft_mod() {
local ibft_mac=$1 local ibft_mac=$1
local iface_mac iface_mod
# Return the iSCSI offload module for a given MAC address # Return the iSCSI offload module for a given MAC address
iscsiadm -m iface | while read iface_name iface_desc ; do for iface_desc in $(iscsiadm -m iface | cut -f 2 -d ' '); do
IFS=$',' iface_mod=${iface_desc%%,*}
set -- $iface_desc iface_mac=${iface_desc#*,}
if [ "$ibft_mac" = "$2" ] ; then iface_mac=${iface_mac%%,*}
echo $1 if [ "$ibft_mac" = "$iface_mac" ] ; then
echo $iface_mod
return 0 return 0
fi fi
unset IFS
done done
} }