From: Thomas Blume Date: Mon, 19 Oct 2015 09:39:41 +0200 Subject: Set number of login retries Allow to set the number of login retries from the kernel commandline. References: bsc#919179 Signed-off-by: Thomas Blume --- modules.d/95iscsi/iscsiroot.sh | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) Index: dracut-044/modules.d/95iscsi/iscsiroot.sh =================================================================== --- dracut-044.orig/modules.d/95iscsi/iscsiroot.sh 2016-04-11 18:03:25.433613430 +0200 +++ dracut-044/modules.d/95iscsi/iscsiroot.sh 2016-04-11 18:09:16.269467779 +0200 @@ -41,6 +41,14 @@ if [ -z "${DRACUT_SYSTEMD}" ] && [ -e /s > /tmp/iscsiuio-started fi +#set value for initial login retry +set_login_retries() { + local default retries + default=2 + retries=$(getarg rd.iscsilogin.retries) + return ${retries:-$default} +} + handle_firmware() { if ! iscsiadm -m fw; then @@ -48,11 +56,12 @@ handle_firmware() return 1 fi + ### ToDo: Fix this for iscsiadm for p in $(getargs rd.iscsi.param -d iscsi_param); do iscsi_param="$iscsi_param --param $p" done - if ! iscsiadm -m fw -l; then + if ! iscsiadm -m fw -l ; then warn "iscsiadm: Log-in to iscsi target failed" fi @@ -71,7 +80,7 @@ handle_netroot() local iscsi_username iscsi_password local iscsi_in_username iscsi_in_password local iscsi_iface_name iscsi_netdev_name - local iscsi_param + local iscsi_param param local p # override conf settings by command line options @@ -94,7 +103,7 @@ handle_netroot() arg=$(getarg rd.iscsi.in.password -d iscsi_in_password=) [ -n "$arg" ] && iscsi_in_password=$arg for p in $(getargs rd.iscsi.param -d iscsi_param); do - iscsi_param="$iscsi_param --param $p" + iscsi_param="$iscsi_param $p" done parse_iscsi_root "$1" || return 1 @@ -104,6 +113,15 @@ handle_netroot() ip route get "$iscsi_target_ip" >/dev/null 2>&1 || return 0 fi + #limit iscsistart login retries + if [[ ! "$iscsi_param" =~ "node.session.initial_login_retry_max" ]]; then + set_login_retries + retries=$? + if [ $retries -gt 0 ]; then + iscsi_param="${iscsi_param% } node.session.initial_login_retry_max=$retries" + fi + fi + # XXX is this needed? getarg ro && iscsirw=ro getarg rw && iscsirw=rw @@ -206,7 +224,7 @@ handle_netroot() [ -n "$iscsi_password" ] && $($COMMAND --name=node.session.auth.password --value=$iscsi_password) [ -n "$iscsi_in_username" ] && $($COMMAND --name=node.session.auth.username_in --value=$iscsi_in_username) [ -n "$iscsi_in_password" ] && $($COMMAND --name=node.session.auth.password_in --value=$iscsi_in_password) - [ -n "$iscsi_param" ] && $($COMMAND --name=${iscsi_param%=*} --value=${iscsi_param#*=} + [ -n "$iscsi_param" ] && for param in $iscsi_param; do $($COMMAND --name=${param%=*} --value=${param#*=}); done fi done