Harald Hoyer 460d2c
From 3b869230a08088a4f51d5bde8d5cfc8497779815 Mon Sep 17 00:00:00 2001
Harald Hoyer 460d2c
From: Thomas Blume <Thomas.Blume@suse.com>
Harald Hoyer 460d2c
Date: Mon, 6 Jul 2020 15:16:35 +0200
Harald Hoyer 460d2c
Subject: [PATCH] 95iscsi: fix ipv6 target discovery
Harald Hoyer 460d2c
Harald Hoyer 460d2c
ipv6 addresses need square brackets, otherwise the iscsi discovery and log-in,
Harald Hoyer 460d2c
which adds the iscsi port after another colon will get confused and fail.
Harald Hoyer 460d2c
---
Harald Hoyer 460d2c
 modules.d/95iscsi/iscsiroot.sh | 3 +++
Harald Hoyer 460d2c
 1 file changed, 3 insertions(+)
Harald Hoyer 460d2c
Harald Hoyer 460d2c
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
Harald Hoyer 460d2c
index cc2ed2cc..ac43b487 100755
Harald Hoyer 460d2c
--- a/modules.d/95iscsi/iscsiroot.sh
Harald Hoyer 460d2c
+++ b/modules.d/95iscsi/iscsiroot.sh
Harald Hoyer 460d2c
@@ -213,6 +213,9 @@ handle_netroot()
Harald Hoyer 460d2c
             echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
Harald Hoyer 460d2c
     fi
Harald Hoyer 460d2c
 
Harald Hoyer 460d2c
+    if strglobin $iscsi_target_ip '*:*:*' && ! strglobin $iscsi_target_ip '['; then
Harald Hoyer 460d2c
+        iscsi_target_ip="[$iscsi_target_ip]"
Harald Hoyer 460d2c
+    fi
Harald Hoyer 460d2c
     targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/')
Harald Hoyer 460d2c
     [ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1
Harald Hoyer 460d2c
 
Harald Hoyer 460d2c