summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2020-05-26 10:00:27 +0200
committerJonathan Bauer2020-05-26 10:00:27 +0200
commit9026a259303621a40fa90fb50ba1bed1b07762cf (patch)
treec679039a827e4ec516e9eeafe7f66a4a9649f827
parentbuild-initramfs.sh: quickfix: clone kernel-qcow2 (diff)
downloadsystemd-init-9026a259303621a40fa90fb50ba1bed1b07762cf.tar.gz
systemd-init-9026a259303621a40fa90fb50ba1bed1b07762cf.tar.xz
systemd-init-9026a259303621a40fa90fb50ba1bed1b07762cf.zip
[dnbd3-rootfs] retry dnbd3 connection on failure
some NICs behave strangely. It can happen that they get up long enough during the initqueue hook to finish setting up the network, but go down again in the pre-mount sometimes leading to dnbd3 connection failures. As a workaround, just retry to connect dnbd3 in case it failed.
-rwxr-xr-xbuilder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh23
1 files changed, 13 insertions, 10 deletions
diff --git a/builder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh b/builder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh
index 28bb5176..cb0dc10e 100755
--- a/builder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh
+++ b/builder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh
@@ -73,20 +73,23 @@ exceptions.try
{
(
IFS=", "
-for host in ${SLX_DNBD3_SERVERS} FAIL; do
- if [ "$host" = "FAIL" ]; then
+for try in {1..5} FAIL; do
+ if [ "$try" = "FAIL" ]; then
emergency_shell "Failed to connect '${SLX_DNBD3_IMAGE}' "\
"${SLX_DNBD3_RID:+(revision: $SLX_DNBD3_RID)} "
"from one of '$SLX_DNBD3_SERVERS' to '$_dnbd3_dev'."
fi
- logging.info "Trying host \"$host\"."
- if systemd-preserve-process-marker dnbd3-client \
- --host "$host" \
- --image "${SLX_DNBD3_IMAGE}" \
- --device "$_dnbd3_dev" \
- "${_dnbd3_client_additional_args[@]}"; then
- break
- fi
+ for host in ${SLX_DNBD3_SERVERS}; do
+ logging.info "Trying host \"$host\"."
+ if systemd-preserve-process-marker dnbd3-client \
+ --host "$host" \
+ --image "${SLX_DNBD3_IMAGE}" \
+ --device "$_dnbd3_dev" \
+ "${_dnbd3_client_additional_args[@]}"; then
+ break 2
+ fi
+ sleep 1
+ done
done
)
# endregion