If hardware iscsi is configured, we don't have to pass the setup information
to 2nd kernel. Because with cmdline argument "rd.iscsi.firmware", dracut
will automatically retrieve the setup information from hardware's firmware.
Add two functions to do the check. One is checking if we have
"rd.iscsi.firmware" or its equivalents specified in kernel cmdline. The
other is to check if the current iscsi session is hardware iscsi.
I read some iscsi code and I also talked with storage QE. It's confirmed
that software iscsi will use "tcp" transport class while hardware iscsi
will use like "be2iscsi" "bnx2i" transport class. It's ok to use
the
transport name of an iface of a scsi session to determine hardware iscsi
or not.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
dracut-module-setup.sh | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index dcebc47..bca21ea 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -411,6 +411,38 @@ kdump_get_iscsi_initiator() {
return 1
}
+# Determine hardware iscsi by an iface's transport class.
+# If transport class is tcp, it's software iscsi.
+# If it's be2iscsi, bnx2i, cxgb3i, cxgb4i, it's hardware iscsi.
+kdump_is_iscsi_hw_session() {
+ if [ "$(kdump_iscsi_get_rec_val $1 "iface.transport_name")" = tcp
]; then
+ return 1
+ fi
+
+ return 0
+}
+
+# kernel cmdline must contain these either of the following arguments
+# for booting off hardware iSCSI:
+# rd.iscsi.firmware[=1], iscsi_firmware
+kdump_is_iscsi_hw_cmdline() {
+ local cmdline
+
+ cmdline="$(cat /proc/cmdline)"
+
+ for arg in $cmdline; do
+ case "$arg" in
+ "rd.iscsi.firmware" |\
+ "rd.iscsi.firmware=1" |\
+ "iscsi_firmware")
+ return 0
+ ;;
+ esac
+ done
+
+ return 1
+}
+
# No ibft handling yet.
kdump_setup_iscsi_device() {
local path=$1
--
1.9.3