File 0196-ibft-wait-for-session-on-all-paths.patch of Package dracut.16003

From 3944cdfd4d99c3d7cd8e801f786e75ed6d254e51 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.com>
Date: Tue, 23 Aug 2016 12:33:34 +0200
Subject: 95iscsi: Wait for session on all paths

References: bsc#951003

Signed-off-by: Thomas Renninger <trenn@suse.com>
---
 modules.d/95iscsi/iscsiroot.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index 4412188..6ef6276 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -51,11 +51,23 @@ set_login_retries() {
 
 handle_firmware()
 {
+    local ifaces retry
+
     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
+
     if ! iscsiadm -m fw -l; then
         warn "iscsiadm: Log-in to iscsi target failed"
     fi
-- 
2.6.6

openSUSE Build Service is sponsored by