[Pkg-xen-devel] Bug#1106420: xen-utils-common: block-iscsi script doesn't work when iqn is a prefix of an existing iqn
Tim Woodall
debianbugs at woodall.me.uk
Sat May 24 17:33:10 BST 2025
Package: xen-utils-common
Version: 4.17.5+23-ga4e5191dc0-1+deb12u1
Severity: normal
two issues with block-iscsi
1. If the iqn that is being used as a disk device is a prefix of an
existing in use iqn then xl create will fail with
libxl: error: libxl_device.c:1337:device_hotplug_child_death_cb: script: Device already opened
My fix is to match a space before and after the iqn.
iscsiadm -m session | grep ' iqn.xen17:trixie17 '
tcp: [32] [fd01:8b0:bfcd:100:230:18ff:fe08:5ad6]:3260,1 iqn.xen17:trixie17 (non-flash)
Without the trailing space:
iscsiadm -m session | grep 'iqn.xen17:trixie17'
tcp: [30] [fd01:8b0:bfcd:100:230:18ff:fe08:5ad6]:3260,1 iqn.xen17:trixie17-build (non-flash)
tcp: [32] [fd01:8b0:bfcd:100:230:18ff:fe08:5ad6]:3260,1 iqn.xen17:trixie17 (non-flash)
2. There's no way to specify the LUN, it seems to always want lun-0. All
of my LUNS are 1, so I've changed the default to 1 rather than 0 but it
needs an extra lun=<> parameter.
diff -u scripts/block-iscsi.distrib scripts/block-iscsi
--- scripts/block-iscsi.distrib 2022-12-29 23:12:25.000000000 +0000
+++ scripts/block-iscsi 2025-05-24 16:24:53.000000000 +0000
@@ -26,6 +26,8 @@
dir=$(dirname "$0")
. "$dir/block-common.sh"
+LUN=1
+
remove_label()
{
echo $1 | sed "s/^\("$2"\)//"
@@ -59,6 +61,9 @@
multipath=*)
multipath=$(remove_label $param "multipath=")
;;
+ lun=*)
+ LUN=$(remove_label $param "lun=")
+ ;;
esac
done
if [ -z "$iqn" ] || [ -z "$portal" ]; then
@@ -73,7 +78,7 @@
find_device()
{
count=0
- while [ ! -e /dev/disk/by-path/*"$iqn"-lun-0 ]; do
+ while [ ! -e /dev/disk/by-path/*"$iqn"-lun-"${LUN}" ]; do
sleep 1
count=`expr $count + 1`
if [ count = 100 ]; then
@@ -81,7 +86,7 @@
fatal "timeout waiting for iSCSI disk to settle"
fi
done
- sddev=$(readlink -f /dev/disk/by-path/*"$iqn"-lun-0 || true)
+ sddev=$(readlink -f /dev/disk/by-path/*"$iqn"-lun-"${LUN}" || true)
if [ ! -b "$sddev" ]; then
fatal "Unable to find attached device path"
fi
@@ -109,9 +114,9 @@
prepare()
{
# Check if target is already opened
- iscsiadm -m session 2>&1 | grep -q "$iqn" && fatal "Device already opened"
+ iscsiadm -m session 2>&1 | grep -q " $iqn " && fatal "Device already opened"
# Discover portal targets
- iscsiadm -m discovery -t st -p $portal 2>&1 | grep -q "$iqn" || \
+ iscsiadm -m discovery -t st -p $portal 2>&1 | grep -q " $iqn\$" || \
fatal "No matching target iqn found"
}
-- System Information:
Debian Release: 12.11
APT prefers stable-security
APT policy: (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.1.0-35-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: sysvinit (via /sbin/init)
Versions of packages xen-utils-common depends on:
ii libc6 2.36-9+deb12u10
ii libxenhypfs1 4.17.5+23-ga4e5191dc0-1+deb12u1
ii libxenstore4 4.17.5+23-ga4e5191dc0-1+deb12u1
ii lsb-base 11.6
ii python3 3.11.2-1+b1
ii sysvinit-utils [lsb-base] 3.06-4
ii ucf 3.0043+nmu1+deb12u1
ii udev 252.36-1~deb12u1
ii xenstore-utils 4.17.5+23-ga4e5191dc0-1+deb12u1
xen-utils-common recommends no packages.
Versions of packages xen-utils-common suggests:
pn xen-doc <none>
-- Configuration Files:
/etc/xen/scripts/block-iscsi changed:
<snip - diff above>
-- no debconf information
More information about the Pkg-xen-devel
mailing list