]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Implement 'rd.timeout' to modify the device timeout
authorHannes Reinecke <hare@suse.de>
Thu, 11 Dec 2014 14:46:05 +0000 (15:46 +0100)
committerHarald Hoyer <harald@redhat.com>
Tue, 16 Dec 2014 12:29:36 +0000 (13:29 +0100)
When generating units for devices the administrator might
want to use a different timeout than the default.
So implement a new parameter 'rd.timeout' for this.

References: bnc#878770

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
dracut.cmdline.7.asc
modules.d/98systemd/rootfs-generator.sh
modules.d/99base/dracut-lib.sh

index 8e4835d6b7701979f29a25fa65901c0a80636083..5ff84ef8b841559cb6a820cc46682bf9e1be6e7e 100644 (file)
@@ -142,11 +142,16 @@ Misc
     have been loaded. This parameter can be specified multiple times.
 
 **rd.retry=**__<seconds>__::
-    specify how long dracut should wait for devices to appear.
+    specify how long dracut should retry the initqueue to configure devices.
     The default is 30 seconds. After 2/3 of the time, degraded raids are force
     started. If you have hardware, which takes a very long time to announce its
     drives, you might want to extend this value.
 
+**rd.timeout=**__<seconds>__::
+    specify how long dracut should wait for devices to appear. The
+    default is '0', which means 'forever'. Note that this timeout
+    should be longer than rd.retry to allow for proper configuration.
+
 **rd.noverifyssl**::
     accept self-signed certificates for ssl downloads.
 
index 95237290bde2c370fc708f8c561128fb600dfcb2..5b061377dc1c5c2d3c63958c39d9c4d71e27caf9 100755 (executable)
@@ -5,8 +5,11 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
 generator_wait_for_dev()
 {
     local _name
+    local _timeout
 
     _name="$(str_replace "$1" '/' '\x2f')"
+    _timeout=$(getarg rd.timeout)
+    _timeout=${_timeout:-0}
 
     [ -e "$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0
 
@@ -27,7 +30,7 @@ generator_wait_for_dev()
         mkdir -p /run/systemd/generator/${_name}.device.d
         {
             echo "[Unit]"
-            echo "JobTimeoutSec=0"
+            echo "JobTimeoutSec=$_timeout"
         } > /run/systemd/generator/${_name}.device.d/timeout.conf
     fi
 }
@@ -58,6 +61,6 @@ case "$root" in
         rootok=1 ;;
 esac
 
-[ "${root%%:*}" = "block" ] && generator_wait_for_dev "${root#block:}"
+[ "${root%%:*}" = "block" ] && generator_wait_for_dev "${root#block:}" "$RDRETRY"
 
 exit 0
index 5fc56154318c0562bc4e927c3ab76dc69486e682..f7cffc4fe263ce51e27f6a9a04850dcc7ccabf7a 100755 (executable)
@@ -890,12 +890,16 @@ wait_for_dev()
     local _name
     local _needreload
     local _noreload
+    local _timeout
 
     if [ "$1" = "-n" ]; then
         _noreload=1
         shift
     fi
 
+    _timeout=$(getarg rd.timeout)
+    _timeout=${_timeout:-0}
+
     _name="$(str_replace "$1" '/' '\x2f')"
 
     type mark_hostonly >/dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh"
@@ -922,7 +926,7 @@ wait_for_dev()
             mkdir -p ${PREFIX}/etc/systemd/system/${_name}.device.d
             {
                 echo "[Unit]"
-                echo "JobTimeoutSec=0"
+                echo "JobTimeoutSec=$_timeout"
             } > ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf
             type mark_hostonly >/dev/null 2>&1 && mark_hostonly /etc/systemd/system/${_name}.device.d/timeout.conf
             _needreload=1