diff options
author | Jonathan Bauer | 2020-05-26 10:00:27 +0200 |
---|---|---|
committer | Jonathan Bauer | 2020-05-26 10:00:27 +0200 |
commit | 9026a259303621a40fa90fb50ba1bed1b07762cf (patch) | |
tree | c679039a827e4ec516e9eeafe7f66a4a9649f827 | |
parent | build-initramfs.sh: quickfix: clone kernel-qcow2 (diff) | |
download | systemd-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-x | builder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh | 23 |
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 |