]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
iscsi: run iscsiroot even if no network configured
authorHarald Hoyer <harald@redhat.com>
Thu, 7 Mar 2013 13:16:11 +0000 (14:16 +0100)
committerHarald Hoyer <harald@redhat.com>
Thu, 7 Mar 2013 13:17:49 +0000 (14:17 +0100)
Also inject finished hooks for every iscsiroot netroot

modules.d/95iscsi/iscsiroot.sh
modules.d/95iscsi/parse-iscsiroot.sh

index 463fa458ac9cfdd66600eeb8937d01bf9ad0f8f5..aa6c6ecebfdfcf0ad74301215fdadc5783bcf90a 100755 (executable)
@@ -53,6 +53,8 @@ if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
     done
 
     iscsistart -b $iscsi_param
+    echo 'started' > "/tmp/iscsistarted-iscsi"
+    echo 'started' > "/tmp/iscsistarted-firmware"
     exit 0
 fi
 
@@ -146,9 +148,6 @@ handle_netroot()
         echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
     fi
 
-    # inject new exit_if_exists
-    echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/iscsi-settle.sh
-
     # force udevsettle to break
     > $hookdir/initqueue/work
 
@@ -163,6 +162,10 @@ handle_netroot()
        ${iscsi_netdev_name+--param iface.net_ifacename=$iscsi_netdev_name} \
         ${iscsi_param} \
        || :
+
+    netroot_enc=$(str_replace "$1" '/' '\2f')
+    echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
+
 }
 
 # loop over all netroot parameter
index eccde3cc3aa3a84003db3e7b99cec4f515eeb04f..286e3dcfd6f7584d704b7105cea7ce584c81895a 100755 (executable)
@@ -62,6 +62,7 @@ if [ -n "$iscsi_firmware" ] ; then
     netroot=${netroot:-iscsi}
     modprobe -q iscsi_boot_sysfs 2>/dev/null
     modprobe -q iscsi_ibft
+    echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_firmware_started.sh
 fi
 
 # If it's not iscsi we don't continue
@@ -83,9 +84,17 @@ if ! [ -e /sys/module/iscsi_tcp ]; then
     modprobe -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
 fi
 
+if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
+    if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
+        initqueue --onetime --settled /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
+    fi
+fi
+
+netroot_enc=$(str_replace "$netroot" '/' '\2f')
+echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
+
 # Done, all good!
 rootok=1
 
 # Shut up init error check
 [ -z "$root" ] && root="iscsi"
-