From 1ab6778ee405d684da4ab34d2e1502c2c29c2e96 Mon Sep 17 00:00:00 2001 From: Lee Duncan Date: Mon, 25 Mar 2019 16:49:19 -0700 Subject: [PATCH] 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. --- modules.d/95iscsi/iscsiroot.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh index 4efc1d129..f3f88259f 100755 --- a/modules.d/95iscsi/iscsiroot.sh +++ b/modules.d/95iscsi/iscsiroot.sh @@ -228,7 +228,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 \ @@ -238,14 +238,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') -- 2.47.3