net-lib.sh:parse_iscsi_root() fix target parsing
For targets with colons in the iSCSI target name: "iqn.2000-09.com.foo:storage-system.e2000:00000001cm1p1" the parser was confused with the optional iscsi_iface_name and iscsi_netdev_name. This patch reintroduces the old IQN, EUI and NAA parsing and enhances the fallback parser by checking the LUN for a numerical value.master
parent
4089949033
commit
36e8ce4fb0
|
@ -308,6 +308,23 @@ parse_iscsi_root()
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
unset iscsi_target_name
|
||||||
|
# extract target name
|
||||||
|
case "$v" in
|
||||||
|
*:iqn.*)
|
||||||
|
iscsi_target_name=iqn.${v##*:iqn.}
|
||||||
|
v=${v%:iqn.*}:
|
||||||
|
;;
|
||||||
|
*:eui.*)
|
||||||
|
iscsi_target_name=iqn.${v##*:eui.}
|
||||||
|
v=${v%:iqn.*}:
|
||||||
|
;;
|
||||||
|
*:naa.*)
|
||||||
|
iscsi_target_name=iqn.${v##*:naa.}
|
||||||
|
v=${v%:iqn.*}:
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# parse the rest
|
# parse the rest
|
||||||
OLDIFS="$IFS"
|
OLDIFS="$IFS"
|
||||||
IFS=:
|
IFS=:
|
||||||
|
@ -317,24 +334,33 @@ parse_iscsi_root()
|
||||||
iscsi_protocol=$1; shift # ignored
|
iscsi_protocol=$1; shift # ignored
|
||||||
iscsi_target_port=$1; shift
|
iscsi_target_port=$1; shift
|
||||||
|
|
||||||
|
if [ -n "$iscsi_target_name" ]; then
|
||||||
|
if [ $# -eq 3 ]; then
|
||||||
|
iscsi_iface_name=$1; shift
|
||||||
|
fi
|
||||||
|
if [ $# -eq 2 ]; then
|
||||||
|
iscsi_netdev_name=$1; shift
|
||||||
|
fi
|
||||||
|
iscsi_lun=$1; shift
|
||||||
|
if [ $# -ne 0 ]; then
|
||||||
|
warn "Invalid parameter in iscsi: parameter!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ $# -gt 3 ] && [ -n "$1$2" ]; then
|
if [ $# -gt 3 ] && [ -n "$1$2" ]; then
|
||||||
|
if [ -z "$3" ] || [ "$3" -ge 0 ] 2>/dev/null ; then
|
||||||
iscsi_iface_name=$1; shift
|
iscsi_iface_name=$1; shift
|
||||||
iscsi_netdev_name=$1; shift
|
iscsi_netdev_name=$1; shift
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
iscsi_lun=$1; shift
|
iscsi_lun=$1; shift
|
||||||
|
|
||||||
if [ $# -gt 2 ]; then
|
iscsi_target_name=$(printf "%s:" "$@")
|
||||||
warn "Invalid parameter in iscsi: parameter!"
|
iscsi_target_name=${iscsi_target_name%:}
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $# -eq 2 ]; then
|
|
||||||
iscsi_target_name="$1:$2"
|
|
||||||
else
|
|
||||||
iscsi_target_name="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ip_to_var() {
|
ip_to_var() {
|
||||||
|
|
Loading…
Reference in New Issue