[PATCH] dracut-module-setup: Return from iscsi path immediately for hardward iscsi without iBFT

Minfei Huang mhuang at redhat.com
Thu Sep 24 05:29:16 UTC 2015


Hardware iscsi can export the iscsi device before starting to load the
kernel code, which setups the iscsi card using the config stored in
hardward iscsi card memory.

kdump need not do anything for this sort of hardware iscsi card, if this
card does not have the feature iBFT. IBFT can export the iscsi
configuration from hardware iscsi card memroy to current running kernel.
Thus iscsiadm cann't get the iscsi session info using "iscsiadm -m
session -r /sys/block/xxx", due to limitation of iscsi info exported by
kernel.

Once the machine is plugged in this sort of hardware iscsi card, kdump
returns as soon as possible.

Signed-off-by: Minfei Huang <mhuang at redhat.com>
---
 dracut-module-setup.sh | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 9b398eb..e2fef9b 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -507,16 +507,6 @@ kdump_setup_iscsi_device() {
     local netroot_conf="${initdir}/etc/cmdline.d/50iscsi.conf"
     local initiator_conf="/etc/iscsi/initiatorname.iscsi"
 
-    dinfo "Found iscsi component $1"
-
-    # Check once before getting explicit values, so we can output a decent
-    # error message.
-
-    if ! /sbin/iscsiadm -m session -r ${path} >/dev/null ; then
-        derror "Unable to find iscsi record for $path"
-        return 1
-    fi
-
     tgt_name=$(kdump_iscsi_get_rec_val ${path} "node.name")
     tgt_ipaddr=$(kdump_iscsi_get_rec_val ${path} "node.conn\[0\].address")
 
@@ -583,7 +573,18 @@ kdump_check_iscsi_targets () {
         until [[ -d sys || -d iscsi_session ]]; do
             cd ..
         done
-        [[ -d iscsi_session ]] && kdump_setup_iscsi_device "$PWD"
+        if [[ -d iscsi_session ]]; then
+            dinfo "Found iscsi component $PWD"
+
+            # Hardware iscsi without the iBFT will fail to get
+            # iscsi session info, and return non-zero
+            # We need not do anything for this sort of hardware iscsi
+            /sbin/iscsiadm -m session -r "$PWD" 2>&- >/dev/null
+            if [ $? -eq 0 ]; then
+                # start to take care of iBFT
+                kdump_setup_iscsi_device "$PWD"
+            fi
+        fi
     )
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-- 
2.1.0



More information about the kexec mailing list