|
Harald Hoyer |
bb31e7 |
From d94050ddaea8343d8adb8f151c8f4cad591d29d9 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
bb31e7 |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
bb31e7 |
Date: Wed, 12 Aug 2015 14:33:49 +0200
|
|
Harald Hoyer |
bb31e7 |
Subject: [PATCH] iscsi: integrate with systemd and improve robustness
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
parse-cmdline sets up an initial initiator-name to let iscsid start.
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
iscsid is started before doing any iscsistart business.
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
iscsistart is done with systemd-run asynchrone to do things in
|
|
Harald Hoyer |
bb31e7 |
paralllel. Also restarted for every new interface which shows up.
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
If rd.iscsi.waitnet (default) is set, iscsistart is done only
|
|
Harald Hoyer |
bb31e7 |
after all interfaces are up.
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
If not all interfaces are up and rd.iscsi.testroute (default) is set,
|
|
Harald Hoyer |
bb31e7 |
the route to a iscsi target IP is checked and skipped, if there is none.
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
If all things fail, we issue a "dummy" interface iscsiroot to retry
|
|
Harald Hoyer |
bb31e7 |
everything in the initqueue/timeout.
|
|
Harald Hoyer |
bb31e7 |
---
|
|
Harald Hoyer |
bb31e7 |
modules.d/95iscsi/cleanup-iscsi.sh | 2 +-
|
|
Harald Hoyer |
bb31e7 |
modules.d/95iscsi/iscsiroot.sh | 116 ++++++++++++++++++++++++-----------
|
|
Harald Hoyer |
bb31e7 |
modules.d/95iscsi/module-setup.sh | 31 ++++++++++
|
|
Harald Hoyer |
bb31e7 |
modules.d/95iscsi/parse-iscsiroot.sh | 13 +++-
|
|
Harald Hoyer |
bb31e7 |
4 files changed, 125 insertions(+), 37 deletions(-)
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
diff --git a/modules.d/95iscsi/cleanup-iscsi.sh b/modules.d/95iscsi/cleanup-iscsi.sh
|
|
Harald Hoyer |
bb31e7 |
index e97d65a..bfc8aef 100755
|
|
Harald Hoyer |
bb31e7 |
--- a/modules.d/95iscsi/cleanup-iscsi.sh
|
|
Harald Hoyer |
bb31e7 |
+++ b/modules.d/95iscsi/cleanup-iscsi.sh
|
|
Harald Hoyer |
bb31e7 |
@@ -1,4 +1,4 @@
|
|
Harald Hoyer |
bb31e7 |
#!/bin/sh
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
-[ -e /sys/module/bnx2i ] && killproc iscsiuio
|
|
Harald Hoyer |
bb31e7 |
+[ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && killproc iscsiuio
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
|
|
Harald Hoyer |
bb31e7 |
index 460e438..fc62425 100755
|
|
Harald Hoyer |
bb31e7 |
--- a/modules.d/95iscsi/iscsiroot.sh
|
|
Harald Hoyer |
bb31e7 |
+++ b/modules.d/95iscsi/iscsiroot.sh
|
|
Harald Hoyer |
bb31e7 |
@@ -36,7 +36,7 @@ iroot=${iroot#:}
|
|
Harald Hoyer |
bb31e7 |
# figured out a way how to check whether this is built-in or not
|
|
Harald Hoyer |
bb31e7 |
modprobe crc32c 2>/dev/null
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
-if [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then
|
|
Harald Hoyer |
bb31e7 |
+if [ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then
|
|
Harald Hoyer |
bb31e7 |
iscsiuio
|
|
Harald Hoyer |
bb31e7 |
> /tmp/iscsiuio-started
|
|
Harald Hoyer |
bb31e7 |
fi
|
|
Harald Hoyer |
bb31e7 |
@@ -105,28 +105,47 @@ handle_netroot()
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
parse_iscsi_root "$1" || return 1
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
+ # Bail out early, if there is no route to the destination
|
|
Harald Hoyer |
bb31e7 |
+ if is_ip "$iscsi_target_ip" && [ "$netif" != "dummy" ] && ! all_ifaces_up && getargbool 1 rd.iscsi.testroute; then
|
|
Harald Hoyer |
bb31e7 |
+ ip route get "$iscsi_target_ip" >/dev/null 2>&1 || return 0
|
|
Harald Hoyer |
bb31e7 |
+ fi
|
|
Harald Hoyer |
bb31e7 |
+
|
|
Harald Hoyer |
bb31e7 |
# XXX is this needed?
|
|
Harald Hoyer |
bb31e7 |
getarg ro && iscsirw=ro
|
|
Harald Hoyer |
bb31e7 |
getarg rw && iscsirw=rw
|
|
Harald Hoyer |
bb31e7 |
fsopts=${fsopts:+$fsopts,}${iscsirw}
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
+ if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
|
|
Harald Hoyer |
bb31e7 |
+ iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
|
|
Harald Hoyer |
bb31e7 |
+ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
+ rm -f /etc/iscsi/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
+ mkdir -p /etc/iscsi
|
|
Harald Hoyer |
bb31e7 |
+ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
+ systemctl restart iscsid
|
|
Harald Hoyer |
bb31e7 |
+ sleep 1
|
|
Harald Hoyer |
bb31e7 |
+ > /tmp/iscsi_set_initiator
|
|
Harald Hoyer |
bb31e7 |
+ fi
|
|
Harald Hoyer |
bb31e7 |
+
|
|
Harald Hoyer |
bb31e7 |
if [ -z $iscsi_initiator ]; then
|
|
Harald Hoyer |
bb31e7 |
- # XXX Where are these from?
|
|
Harald Hoyer |
bb31e7 |
+ [ -f /run/initiatorname.iscsi ] && . /run/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
[ -f /etc/initiatorname.iscsi ] && . /etc/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
[ -f /etc/iscsi/initiatorname.iscsi ] && . /etc/iscsi/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
iscsi_initiator=$InitiatorName
|
|
Harald Hoyer |
bb31e7 |
-
|
|
Harald Hoyer |
bb31e7 |
- # XXX rfc3720 says 'SCSI Initiator Name: The iSCSI Initiator Name specifies
|
|
Harald Hoyer |
bb31e7 |
- # the worldwide unique name of the initiator.' Could we use hostname/ip
|
|
Harald Hoyer |
bb31e7 |
- # if missing?
|
|
Harald Hoyer |
bb31e7 |
fi
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
if [ -z $iscsi_initiator ]; then
|
|
Harald Hoyer |
bb31e7 |
- if [ -f /sys/firmware/ibft/initiator/initiator-name ]; then
|
|
Harald Hoyer |
bb31e7 |
- iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
|
|
Harald Hoyer |
bb31e7 |
- fi
|
|
Harald Hoyer |
bb31e7 |
+ iscsi_initiator=$(iscsi-iname)
|
|
Harald Hoyer |
bb31e7 |
+ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
+ rm -f /etc/iscsi/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
+ mkdir -p /etc/iscsi
|
|
Harald Hoyer |
bb31e7 |
+ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
+ systemctl restart iscsid
|
|
Harald Hoyer |
bb31e7 |
+ > /tmp/iscsi_set_initiator
|
|
Harald Hoyer |
bb31e7 |
+ # FIXME: iscsid is not yet ready, when the service is :-/
|
|
Harald Hoyer |
bb31e7 |
+ sleep 1
|
|
Harald Hoyer |
bb31e7 |
fi
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
+
|
|
Harald Hoyer |
bb31e7 |
if [ -z $iscsi_target_port ]; then
|
|
Harald Hoyer |
bb31e7 |
iscsi_target_port=3260
|
|
Harald Hoyer |
bb31e7 |
fi
|
|
Harald Hoyer |
bb31e7 |
@@ -135,23 +154,21 @@ handle_netroot()
|
|
Harald Hoyer |
bb31e7 |
iscsi_target_group=1
|
|
Harald Hoyer |
bb31e7 |
fi
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
- if [ -z $iscsi_initiator ]; then
|
|
Harald Hoyer |
bb31e7 |
- # XXX is this correct?
|
|
Harald Hoyer |
bb31e7 |
- iscsi_initiator=$(iscsi-iname)
|
|
Harald Hoyer |
bb31e7 |
- fi
|
|
Harald Hoyer |
bb31e7 |
-
|
|
Harald Hoyer |
bb31e7 |
if [ -z $iscsi_lun ]; then
|
|
Harald Hoyer |
bb31e7 |
iscsi_lun=0
|
|
Harald Hoyer |
bb31e7 |
fi
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
- echo "InitiatorName='$iscsi_initiator'" > /run/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
+ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
-
|
|
Harald Hoyer |
bb31e7 |
+ if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then
|
|
Harald Hoyer |
bb31e7 |
+ mkdir -p /etc/iscsi
|
|
Harald Hoyer |
bb31e7 |
+ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
+ fi
|
|
Harald Hoyer |
bb31e7 |
# FIXME $iscsi_protocol??
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
- if [ "$root" = "dhcp" ]; then
|
|
Harald Hoyer |
bb31e7 |
+ if [ "$root" = "dhcp" ] || [ "$netroot" = "dhcp" ]; then
|
|
Harald Hoyer |
bb31e7 |
# if root is not specified try to mount the whole iSCSI LUN
|
|
Harald Hoyer |
bb31e7 |
- printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules
|
|
Harald Hoyer |
bb31e7 |
+ printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' "$iscsi_lun" >> /etc/udev/rules.d/99-iscsi-root.rules
|
|
Harald Hoyer |
bb31e7 |
udevadm control --reload
|
|
Harald Hoyer |
bb31e7 |
write_fs_tab /dev/root
|
|
Harald Hoyer |
bb31e7 |
wait_for_dev -n /dev/root
|
|
Harald Hoyer |
bb31e7 |
@@ -161,29 +178,58 @@ handle_netroot()
|
|
Harald Hoyer |
bb31e7 |
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
|
|
Harald Hoyer |
bb31e7 |
fi
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
- # force udevsettle to break
|
|
Harald Hoyer |
bb31e7 |
- > $hookdir/initqueue/work
|
|
Harald Hoyer |
bb31e7 |
-
|
|
Harald Hoyer |
bb31e7 |
- iscsistart -i $iscsi_initiator -t $iscsi_target_name \
|
|
Harald Hoyer |
bb31e7 |
- -g $iscsi_target_group -a $iscsi_target_ip \
|
|
Harald Hoyer |
bb31e7 |
- -p $iscsi_target_port \
|
|
Harald Hoyer |
bb31e7 |
- ${iscsi_username:+-u $iscsi_username} \
|
|
Harald Hoyer |
bb31e7 |
- ${iscsi_password:+-w $iscsi_password} \
|
|
Harald Hoyer |
bb31e7 |
- ${iscsi_in_username:+-U $iscsi_in_username} \
|
|
Harald Hoyer |
bb31e7 |
- ${iscsi_in_password:+-W $iscsi_in_password} \
|
|
Harald Hoyer |
bb31e7 |
- ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
|
|
Harald Hoyer |
bb31e7 |
- ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
|
|
Harald Hoyer |
bb31e7 |
- ${iscsi_param} \
|
|
Harald Hoyer |
bb31e7 |
- || :
|
|
Harald Hoyer |
bb31e7 |
-
|
|
Harald Hoyer |
bb31e7 |
+ if [ -n "$DRACUT_SYSTEMD" ] && command -v systemd-run >/dev/null 2>&1; then
|
|
Harald Hoyer |
bb31e7 |
+ netroot_enc=$(systemd-escape "iscsistart_${1}")
|
|
Harald Hoyer |
bb31e7 |
+ status=$(systemctl is-active "$netroot_enc" 2>/dev/null)
|
|
Harald Hoyer |
bb31e7 |
+ is_active=$?
|
|
Harald Hoyer |
bb31e7 |
+ if [ $is_active -ne 0 ]; then
|
|
Harald Hoyer |
bb31e7 |
+ if [ "$status" != "activating" ] && ! systemctl is-failed "$netroot_enc" >/dev/null 2>&1; then
|
|
Harald Hoyer |
bb31e7 |
+ systemd-run --no-block --service-type=oneshot --remain-after-exit --quiet \
|
|
Harald Hoyer |
bb31e7 |
+ --description="Login iSCSI Target $iscsi_target_name" \
|
|
Harald Hoyer |
bb31e7 |
+ --unit="$netroot_enc" -- \
|
|
Harald Hoyer |
bb31e7 |
+ $(command -v iscsistart) \
|
|
Harald Hoyer |
bb31e7 |
+ -i $iscsi_initiator -t $iscsi_target_name \
|
|
Harald Hoyer |
bb31e7 |
+ -g $iscsi_target_group -a $iscsi_target_ip \
|
|
Harald Hoyer |
bb31e7 |
+ -p $iscsi_target_port \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_username:+-u $iscsi_username} \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_password:+-w $iscsi_password} \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_in_username:+-U $iscsi_in_username} \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_in_password:+-W $iscsi_in_password} \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_param} >/dev/null 2>&1
|
|
Harald Hoyer |
bb31e7 |
+ else
|
|
Harald Hoyer |
bb31e7 |
+ systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1
|
|
Harald Hoyer |
bb31e7 |
+ fi
|
|
Harald Hoyer |
bb31e7 |
+ fi
|
|
Harald Hoyer |
bb31e7 |
+ else
|
|
Harald Hoyer |
bb31e7 |
+ > $hookdir/initqueue/work
|
|
Harald Hoyer |
bb31e7 |
+ iscsistart -i $iscsi_initiator -t $iscsi_target_name \
|
|
Harald Hoyer |
bb31e7 |
+ -g $iscsi_target_group -a $iscsi_target_ip \
|
|
Harald Hoyer |
bb31e7 |
+ -p $iscsi_target_port \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_username:+-u $iscsi_username} \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_password:+-w $iscsi_password} \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_in_username:+-U $iscsi_in_username} \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_in_password:+-W $iscsi_in_password} \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
|
|
Harald Hoyer |
bb31e7 |
+ ${iscsi_param} \
|
|
Harald Hoyer |
bb31e7 |
+ || :
|
|
Harald Hoyer |
bb31e7 |
+ fi
|
|
Harald Hoyer |
bb31e7 |
netroot_enc=$(str_replace "$1" '/' '\2f')
|
|
Harald Hoyer |
bb31e7 |
echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
|
|
Harald Hoyer |
bb31e7 |
+ return 0
|
|
Harald Hoyer |
bb31e7 |
}
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
ret=0
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
+if [ "$netif" != "dummy" ] && getargbool 1 rd.iscsi.waitnet; then
|
|
Harald Hoyer |
bb31e7 |
+ all_ifaces_up || exit 0
|
|
Harald Hoyer |
bb31e7 |
+fi
|
|
Harald Hoyer |
bb31e7 |
+
|
|
Harald Hoyer |
bb31e7 |
# loop over all netroot parameter
|
|
Harald Hoyer |
bb31e7 |
-if getarg netroot; then
|
|
Harald Hoyer |
bb31e7 |
+netroot=$(getarg netroot)
|
|
Harald Hoyer |
bb31e7 |
+if [ $? -eq 0 ] && [ "$netroot" != "dhcp" ]; then
|
|
Harald Hoyer |
bb31e7 |
for nroot in $(getargs netroot); do
|
|
Harald Hoyer |
bb31e7 |
[ "${nroot%%:*}" = "iscsi" ] || continue
|
|
Harald Hoyer |
bb31e7 |
nroot="${nroot##iscsi:}"
|
|
Harald Hoyer |
bb31e7 |
@@ -210,6 +256,6 @@ fi
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
need_shutdown
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
-# now we have a root filesystem somewhere in /dev/sda*
|
|
Harald Hoyer |
bb31e7 |
+# now we have a root filesystem somewhere in /dev/sd*
|
|
Harald Hoyer |
bb31e7 |
# let the normal block handler handle root=
|
|
Harald Hoyer |
bb31e7 |
exit $ret
|
|
Harald Hoyer |
bb31e7 |
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
|
|
Harald Hoyer |
bb31e7 |
index 406a9da..3002591 100755
|
|
Harald Hoyer |
bb31e7 |
--- a/modules.d/95iscsi/module-setup.sh
|
|
Harald Hoyer |
bb31e7 |
+++ b/modules.d/95iscsi/module-setup.sh
|
|
Harald Hoyer |
bb31e7 |
@@ -226,6 +226,37 @@ install() {
|
|
Harald Hoyer |
bb31e7 |
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
|
|
Harald Hoyer |
bb31e7 |
if ! dracut_module_included "systemd"; then
|
|
Harald Hoyer |
bb31e7 |
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
|
|
Harald Hoyer |
bb31e7 |
+ else
|
|
Harald Hoyer |
bb31e7 |
+ inst_multiple -o \
|
|
Harald Hoyer |
bb31e7 |
+ $systemdsystemunitdir/iscsi.service \
|
|
Harald Hoyer |
bb31e7 |
+ $systemdsystemunitdir/iscsid.service \
|
|
Harald Hoyer |
bb31e7 |
+ $systemdsystemunitdir/iscsid.socket \
|
|
Harald Hoyer |
bb31e7 |
+ $systemdsystemunitdir/iscsiuio.service \
|
|
Harald Hoyer |
bb31e7 |
+ $systemdsystemunitdir/iscsiuio.socket \
|
|
Harald Hoyer |
bb31e7 |
+ iscsiadm iscsid
|
|
Harald Hoyer |
bb31e7 |
+
|
|
Harald Hoyer |
bb31e7 |
+ mkdir -p "${initdir}/$systemdsystemunitdir/sockets.target.wants"
|
|
Harald Hoyer |
bb31e7 |
+ for i in \
|
|
Harald Hoyer |
bb31e7 |
+ iscsiuio.socket \
|
|
Harald Hoyer |
bb31e7 |
+ ; do
|
|
Harald Hoyer |
bb31e7 |
+ ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/sockets.target.wants/${i}"
|
|
Harald Hoyer |
bb31e7 |
+ done
|
|
Harald Hoyer |
bb31e7 |
+
|
|
Harald Hoyer |
bb31e7 |
+ mkdir -p "${initdir}/$systemdsystemunitdir/basic.target.wants"
|
|
Harald Hoyer |
bb31e7 |
+ for i in \
|
|
Harald Hoyer |
bb31e7 |
+ iscsid.service \
|
|
Harald Hoyer |
bb31e7 |
+ ; do
|
|
Harald Hoyer |
bb31e7 |
+ ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/basic.target.wants/${i}"
|
|
Harald Hoyer |
bb31e7 |
+ done
|
|
Harald Hoyer |
bb31e7 |
+
|
|
Harald Hoyer |
bb31e7 |
+ # Make sure iscsid is started after dracut-cmdline and ready for the initqueue
|
|
Harald Hoyer |
bb31e7 |
+ mkdir -p "${initdir}/$systemdsystemunitdir/iscsid.service.d"
|
|
Harald Hoyer |
bb31e7 |
+ (
|
|
Harald Hoyer |
bb31e7 |
+ echo "[Unit]"
|
|
Harald Hoyer |
bb31e7 |
+ echo "After=dracut-cmdline.service"
|
|
Harald Hoyer |
bb31e7 |
+ echo "Before=dracut-initqueue.service"
|
|
Harald Hoyer |
bb31e7 |
+ ) > "${initdir}/$systemdsystemunitdir/iscsid.service.d/dracut.conf"
|
|
Harald Hoyer |
bb31e7 |
fi
|
|
Harald Hoyer |
bb31e7 |
+
|
|
Harald Hoyer |
bb31e7 |
dracut_need_initqueue
|
|
Harald Hoyer |
bb31e7 |
}
|
|
Harald Hoyer |
bb31e7 |
diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
|
|
Harald Hoyer |
bb31e7 |
index 52f7a97..2532ada 100755
|
|
Harald Hoyer |
bb31e7 |
--- a/modules.d/95iscsi/parse-iscsiroot.sh
|
|
Harald Hoyer |
bb31e7 |
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
|
|
Harald Hoyer |
bb31e7 |
@@ -62,9 +62,10 @@ if [ -n "$iscsi_firmware" ] ; then
|
|
Harald Hoyer |
bb31e7 |
[ -z "$netroot" ] && netroot=iscsi:
|
|
Harald Hoyer |
bb31e7 |
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
|
|
Harald Hoyer |
bb31e7 |
modprobe -b -q iscsi_ibft
|
|
Harald Hoyer |
bb31e7 |
- initqueue --onetime --timeout /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
|
|
Harald Hoyer |
bb31e7 |
fi
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
+initqueue --onetime --timeout /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
|
|
Harald Hoyer |
bb31e7 |
+
|
|
Harald Hoyer |
bb31e7 |
# If it's not iscsi we don't continue
|
|
Harald Hoyer |
bb31e7 |
[ "${netroot%%:*}" = "iscsi" ] || return
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
@@ -86,6 +87,16 @@ if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; the
|
|
Harald Hoyer |
bb31e7 |
fi
|
|
Harald Hoyer |
bb31e7 |
fi
|
|
Harald Hoyer |
bb31e7 |
|
|
Harald Hoyer |
bb31e7 |
+if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ]; then
|
|
Harald Hoyer |
bb31e7 |
+ iscsi_initiator=$arg
|
|
Harald Hoyer |
bb31e7 |
+ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
+ ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
+ if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then
|
|
Harald Hoyer |
bb31e7 |
+ mkdir -p /etc/iscsi
|
|
Harald Hoyer |
bb31e7 |
+ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
|
Harald Hoyer |
bb31e7 |
+ fi
|
|
Harald Hoyer |
bb31e7 |
+fi
|
|
Harald Hoyer |
bb31e7 |
+
|
|
Harald Hoyer |
bb31e7 |
if [ -n "$iscsi_firmware" ] ; then
|
|
Harald Hoyer |
bb31e7 |
echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
|
|
Harald Hoyer |
bb31e7 |
else
|