]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Dracut: only login to one target at a time
authorLee Duncan <lduncan@suse.com>
Mon, 25 Mar 2019 23:49:19 +0000 (16:49 -0700)
committerHarald Hoyer <harald@hoyer.xyz>
Fri, 25 Oct 2019 07:18:12 +0000 (09:18 +0200)
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

index 4efc1d12970af04c8674f1caa339210749f675f2..f3f88259fc1a30669ff0754db8c3e4c2fc729cef 100755 (executable)
@@ -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')