Repository navigation
NAS-144733 / 28.0.0-BETA.1 / truenas-appliance-runner: wait for node B to answer ssh from a new boot after giving it its own ids #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -232,14 +232,24 @@ | |
| head -c 16 /dev/urandom | od -An -tx1 | tr -d " \n" | sudo tee /etc/machine-id >/dev/null | ||
| sudo rm -f /var/lib/dbus/machine-id | ||
| sudo zgenhostid -f' | ||
| local boot now deadline | ||
| boot="$(ssh_ b cat /proc/sys/kernel/random/boot_id)" | ||
| ssh_ b 'sudo systemctl reboot' || true | ||
| # Down before it is waited for: the API answers for a while after the | ||
| # reboot is asked for. | ||
| local i | ||
| for i in $(seq 1 60); do | ||
| ssh_ b true 2>/dev/null || break | ||
| sleep 2 | ||
| # Back once B answers ssh from a new boot. Neither "ssh stopped answering" | ||
| # nor "the API answers" proves that: the API answers for a while after the | ||
| # reboot is asked for, and on the new boot it can answer before sshd does | ||
| # (run 39251437564 read B's ids over ssh and was refused). | ||
| # A refused or timed-out connection (sshd not started yet, the network | ||
| # not up) is just tried again. | ||
| deadline=$((SECONDS + 600)) | ||
| while [ "$SECONDS" -lt "$deadline" ]; do | ||
| now="$(ssh_ b cat /proc/sys/kernel/random/boot_id 2>/dev/null)" || now= | ||
|
Check notice on line 246 in .github/actions/truenas-appliance-runner/ha.sh
|
||
| [ -n "$now" ] && [ "$now" != "$boot" ] && break | ||
| sleep 5 | ||
| done | ||
| if [ -z "$now" ] || [ "$now" = "$boot" ]; then | ||
| die "node B did not come back over ssh from its reboot within 10 minutes" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LOW — "within 10 minutes" counts only the |
||
| fi | ||
| "${TNCTL[@]}" wait "ws://${IP[b]}" "$APPLIANCE_USER" "$password" --timeout 600 >/dev/null | ||
| b="$(ids b)" | ||
| [ "$a" != "$b" ] || die "node B still has A's ids after its reboot: $b" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOW — The 10-minute deadline is only checked between polls, so it doesn't cap a single poll.
ConnectTimeout=10only covers connection setup.ssh_sets noServerAliveInterval/ServerAliveCountMax, so if a poll connects just before B's guest resets (the old boot's sshd is still up during shutdown), the reset sends no RST. Thatsshcall can then block on a dead TCP connection far past the deadline, and thedienever fires. The window is small becausecatreturns at once, so this is unlikely. If you want "by the clock" to actually hold, add-o ServerAliveInterval=5 -o ServerAliveCountMax=2here (or inssh_), or wrap the poll intimeout 20.