From c56c855754914283bb930ef1a2b2dd5e8d5a6f25 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 20 Oct 2015 07:59:43 +0200 Subject: 95iscsi: set 'rd.iscsi.firmware' for qla4xxx sessions The qla4xxx driver can run with or without open-iscsi support, depending on the setting of the 'ql4xdisablesysfsboot' module parameter. When the parameter is set to '0', dracut needs to call 'iscsiadm -m fw' to trigger iSCSI login, so we need to set the 'rd.iscsi.firmware' dracut variable. But this will then fail if the parameter is set to '1', as in these cases the list of firmware targets is empty. To cover both scenarios this patch reshuffles 'handle_firmware' in iscsiroot.sh to continue if iscsiadm -m fw fails but iscsi sessions are present. References: bsc#951003 Signed-off-by: Hannes Reinecke --- modules.d/95iscsi/iscsiroot.sh | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh index 6ef6276..77755fb 100755 --- a/modules.d/95iscsi/iscsiroot.sh +++ b/modules.d/95iscsi/iscsiroot.sh @@ -53,29 +53,34 @@ handle_firmware() { local ifaces retry + # Depending on the 'ql4xdisablesysfsboot' qla4xxx + # will be autostarting sessions without presenting + # them via the firmware interface. + # In these cases 'iscsiadm -m fw' will fail, but + # the iSCSI sessions will still be present. if ! iscsiadm -m fw; then warn "iscsiadm: Could not get list of targets from firmware." - return 1 - fi - - ifaces=( $(echo /sys/firmware/ibft/ethernet*) ) - [ -f /tmp/session-retry ] || echo 1 > /tmp/session-retry - retry=$(cat /tmp/session-retry) - - if [ $retry -lt ${#ifaces[*]} ]; then - let retry++ - echo $retry > /tmp/session-retry - return 1 - fi + else + ifaces=( $(echo /sys/firmware/ibft/ethernet*) ) + [ -f /tmp/session-retry ] || echo 1 > /tmp/session-retry + retry=$(cat /tmp/session-retry) + + if [ $retry -lt ${#ifaces[*]} ]; then + let retry++ + echo $retry > /tmp/session-retry + return 1 + fi - if ! iscsiadm -m fw -l; then - warn "iscsiadm: Log-in to iscsi target failed" + if ! iscsiadm -m fw -l; then + warn "iscsiadm: Log-in to iscsi target failed" + else + need_shutdown + fi fi - + [ -d /sys/class/iscsi_session ] || return 1 echo 'started' > "/tmp/iscsistarted-iscsi:" echo 'started' > "/tmp/iscsistarted-firmware" - need_shutdown return 0 } -- 2.6.6