If we cannot ssh to the host to fish out its own logs, do not try to do any of the other log captures which involve ssh'ing to the host.
This includes {fetch,extract}_logs_guest, which tolerated this situation - so then it's an optimisation. But it also includes shutdown_guests, which was introduced in c5f8d41143ab "ts-logs-capture: Fish some logs out of guest filesystem" and is not tolerant enough. Since that commit, unbootable hosts have caused ts-logs-capture to wrongly declare jobs broken. Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com> --- ts-logs-capture | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ts-logs-capture b/ts-logs-capture index c67856cd..7940aece 100755 --- a/ts-logs-capture +++ b/ts-logs-capture @@ -190,7 +190,7 @@ sub fetch_logs_host () { 1; }) { logm("host reboot failed, abandoning log fetches: $@"); - return; + return 0; } try_fetch_logs($ho, $logs); } @@ -219,6 +219,8 @@ sub fetch_logs_host () { ) { try_cmd_output_save($cmd); } + + return 1; } sub fetch_xenctx_guest ($) { @@ -293,8 +295,9 @@ power_state($ho,1); find_guests(); fetch_xenctx_guest($_) foreach @guests; serial_fetch_logs($ho); -fetch_logs_host(); -fetch_logs_guest($_) foreach @guests; -shutdown_guests(); -extract_logs_guest($_) foreach @allguests; +if (fetch_logs_host()) { + fetch_logs_guest($_) foreach @guests; + shutdown_guests(); + extract_logs_guest($_) foreach @allguests; +} logm("logs captured to $stash"); -- 2.11.0