From: Thomas Renninger Subject: [PATCH 14/42] Implement 'rd.timeout' to modify the device timeout Date: Thu, 11 Dec 2014 15:46:05 +0100 Message-ID: <1418309193-11208-15-git-send-email-trenn@suse.de> References: <1418309193-11208-1-git-send-email-trenn@suse.de> Return-path: In-Reply-To: <1418309193-11208-1-git-send-email-trenn-l3A5Bk7waGM@public.gmane.org> Sender: initramfs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org Cc: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, trenn-l3A5Bk7waGM@public.gmane.org, Hannes Reinecke From: Hannes Reinecke 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 Signed-off-by: Thomas Renninger --- dracut.cmdline.7.asc | 7 ++++++- modules.d/98systemd/rootfs-generator.sh | 7 +++++-- modules.d/99base/dracut-lib.sh | 6 +++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc index 8e4835d..5ff84ef 100644 --- a/dracut.cmdline.7.asc +++ b/dracut.cmdline.7.asc @@ -142,11 +142,16 @@ Misc have been loaded. This parameter can be specified multiple times. **rd.retry=**____:: - 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=**____:: + 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. diff --git a/modules.d/98systemd/rootfs-generator.sh b/modules.d/98systemd/rootfs-generator.sh index 9523729..5b06137 100755 --- a/modules.d/98systemd/rootfs-generator.sh +++ b/modules.d/98systemd/rootfs-generator.sh @@ -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 diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index 5fc5615..f7cffc4 100755 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -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 -- 1.8.5.2