Skip to content

Commit

Permalink
zfsbootmenu: generalize zbm.import_delay as zbm.retry_delay
Browse files Browse the repository at this point in the history
  • Loading branch information
zdykstra committed Jan 17, 2024
1 parent 075cba0 commit 98f7dac
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
11 changes: 7 additions & 4 deletions docs/man/zfsbootmenu.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ These options are set on the kernel command line when booting the initramfs or U
If a literal *!!* has been appended to the pool name, ZFSBootMenu will insist on successfully importing the named pool and no others.


**zbm.import_delay=<time>**
**zbm.retry_delay=<time>**

Should ZFSBootMenu fail to successfully import any pool, it will repeat import attempts indefinitely until at least one pool can be imported or the user chooses to drop to a recovery shell. Each subsequent attempt will proceed after a delay of **<time>** seconds. When **<time>** is unspecified or is anything other than a positive integer, a default value of 5 seconds will be used.
This option determines the interval between repeated attempts of required steps. When **<time>** is unspecified or is anything other than a positive integer, a default value of 5 seconds will be used. Should ZFSBootMenu fail to successfully import any pool, it will repeat import attempts indefinitely until at least one pool can be imported or the user chooses to drop to a recovery shell. Additionally, should any required devices be configured via **zbm.wait_for**, device checks will repeat on this interval.

**zbm.import_policy**

Expand Down Expand Up @@ -143,13 +143,13 @@ These options are set on the kernel command line when booting the initramfs or U

Enable automatic font resizing of the kernel console to normalize the apparent resolution for both low resolution and high resolution displays. This option is enabled by default.

**zbm.waitfor=device,device,...**
**zbm.wait_for=device,device,...**

Ensure that one or more devices are present before starting the pool import process. Devices may be specified as full paths to device nodes (*e.g.*, **/dev/sda** or **/dev/disk/by-id/wwn-0x500a07510ee65912**) or, for convenience, as a typed indicator of the form **TYPE=VALUE**, which will be expanded internally as

**/dev/disk/by-TYPE/VALUE**

The use of full device paths other than descendants of **/dev/disk/** is fragile and should be avoided.
The use of full device paths other than descendants of **/dev/disk/** is fragile and should be avoided. The delay interval between device checks can be controlled by **zbm.retry_delay**.

Deprecated Parameters
---------------------
Expand All @@ -170,6 +170,9 @@ Deprecated Parameters

Deprecated; use **zbm.import_policy=force**.

**zbm.import_delay**

Deprecated; use **zbm.retry_delay**

.. _zfs-properties:

Expand Down
10 changes: 5 additions & 5 deletions zfsbootmenu/libexec/zfsbootmenu-init
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ fi

# Wait for devices to show up

if [ -n "${zbm_waitfor_devices}" ]; then
IFS=',' read -r -a user_devices <<<"${zbm_waitfor_devices}"
if [ -n "${zbm_wait_for_devices}" ]; then
IFS=',' read -r -a user_devices <<<"${zbm_wait_for_devices}"
while true; do
FOUND=0
EXPECTED=0
Expand Down Expand Up @@ -116,8 +116,8 @@ if [ -n "${zbm_waitfor_devices}" ]; then
if [ ${FOUND} -eq ${EXPECTED} ]; then
break
else
if ! timed_prompt -d 3 -e "to cancel" \
-m "" \
if ! timed_prompt -d "${zbm_retry_delay:-5}" \
-e "to cancel" -m "" \
-m "$( colorize red "One or more required devices are missing" )" \
-p "retrying in $( colorize yellow "%0.2d" ) seconds" ; then
for dev in "${missing[@]}" ; do
Expand Down Expand Up @@ -214,7 +214,7 @@ while true; do
zinfo "unable to import a pool on attempt ${zbm_import_attempt}"

# Just keep retrying after a delay until the user presses ESC
if timed_prompt -d "${zbm_import_delay:-5}" \
if timed_prompt -d "${zbm_retry_delay:-5}" \
-p "Unable to import $( colorize magenta "${try_pool:-pool}" ), retrying in $( colorize yellow "%0.2d" ) seconds" \
-r "to retry immediately" \
-e "for a recovery shell"; then
Expand Down
14 changes: 7 additions & 7 deletions zfsbootmenu/pre-init/zfsbootmenu-parse-commandline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ else
zinfo "defaulting menu timeout to ${menu_timeout}"
fi

if zbm_import_delay=$( get_zbm_arg zbm.import_delay ) && [ "${zbm_import_delay:-0}" -gt 0 ] 2>/dev/null ; then
# Again, this validates that zbm_import_delay is numeric in addition to logging
zinfo "import retry delay is ${zbm_import_delay} seconds"
if zbm_retry_delay=$( get_zbm_arg zbm.retry_delay zbm.import_delay ) && [ "${zbm_retry_delay:-0}" -gt 0 ] 2>/dev/null ; then
# Again, this validates that zbm_retry_delay is numeric in addition to logging
zinfo "import/waitfor retry delay is ${zbm_retry_delay} seconds"
else
zbm_import_delay=5
zbm_retry_delay=5
fi

# Allow setting of console size; ensure lines/columns are integers > 0
Expand Down Expand Up @@ -226,9 +226,9 @@ if zbm_prefer_pool=$( get_zbm_arg zbm.prefer ) ; then
zinfo "preferring ${zbm_prefer_pool} for bootfs"
fi

zbm_waitfor_devices=
if zbm_waitfor_devices=$( get_zbm_arg zbm.waitfor ) ; then
zinfo "system will wait for ${zbm_waitfor_devices}"
zbm_wait_for_devices=
if zbm_wait_for_devices=$( get_zbm_arg zbm.wait_for ) ; then
zinfo "system will wait for ${zbm_wait_for_devices}"
fi

# pool! : this pool must be imported before all others
Expand Down
4 changes: 2 additions & 2 deletions zfsbootmenu/pre-init/zfsbootmenu-preinit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export zbm_require_pool='${zbm_require_pool}'
export default_hostid=00bab10c
export zbm_sort='${zbm_sort}'
export zbm_set_hostid='${zbm_set_hostid}'
export zbm_import_delay='${zbm_import_delay}'
export zbm_retry_delay='${zbm_retry_delay}'
export zbm_hook_root='${zbm_hook_root}'
export zbm_waitfor_devices='${zbm_waitfor_devices}'
export zbm_wait_for_devices='${zbm_wait_for_devices}'
export control_term='${control_term}'
# END additions by zfsbootmenu-preinit.sh
EOF
Expand Down

0 comments on commit 98f7dac

Please sign in to comment.