]> 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)
committerDaniel Molkentin <dmolkentin@suse.com>
Wed, 24 Apr 2019 09:32:45 +0000 (11:32 +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 5acb50cab70a6561c9e0013baca1640e638a6f6a..3cbda92282cc640f6469b8b781e3bbbf345da4a2 100755 (executable)
@@ -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')