From: Lee Duncan Date: Mon, 25 Mar 2019 23:49:19 +0000 (-0700) Subject: Dracut: only login to one target at a time X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a59b776bc215ace52aadaa2e6eb5f470c94971f9;p=thirdparty%2Fdracut.git Dracut: only login to one target at a time For handling the configuration where there are two paths to an iscsi root target, each using a different NIC. In such a case, the initramfs was trying to configure the first NIC, then call iscsiroot to login to both targets, which would fail for the 2nd target, since the path to the 2nd target was not yet configured. This would eventually work after a timeout. But it's better to login to just one target at a time. This change makes the initramfs handle multiple paths to an iscsi target better by logging into only one target at a time, rather than trying to login to all targets when only one of several NICs is up. This can be further optimized by using the initrd parameter "rd.iscsi.testroute", which would skip iscsiadm login attempts for targets to which no route exists. If the script is called again via the timeout initqueue, we try "iscsiadm -L onboot" again, hoping that some targets may now have become reachable. --- diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh index 5acb50cab..3cbda9228 100755 --- a/modules.d/95iscsi/iscsiroot.sh +++ b/modules.d/95iscsi/iscsiroot.sh @@ -227,7 +227,7 @@ handle_netroot() fi [ -n "$iscsi_param" ] && for param in $iscsi_param; do EXTRA="$EXTRA --name=${param%=*} --value=${param#*=}"; done - iscsiadm -m node -T $target \ + CMD="iscsiadm -m node -T $target \ ${iscsi_iface_name:+-I $iscsi_iface_name} \ -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} \ --op=update \ @@ -237,14 +237,20 @@ handle_netroot() ${iscsi_in_username:+--name=node.session.auth.username_in --value=$iscsi_in_username} \ ${iscsi_in_password:+--name=node.session.auth.password_in --value=$iscsi_in_password} \ $EXTRA \ - $NULL + $NULL" + $CMD + if [ "$netif" != "timeout" ]; then + $CMD --login + fi ;; *) ;; esac done - iscsiadm -m node -L onboot || : + if [ "$netif" = "timeout" ]; then + iscsiadm -m node -L onboot || : + fi > $hookdir/initqueue/work netroot_enc=$(str_replace "$1" '/' '\2f')